获取或设置指定元素的文本内容。
datax.text(elm,txt)
Example: 查找<p>元素文本,显示在最后一个<p>中。
<!DOCTYPE html> <html> <head> <style> p { color:blue; margin:8px; } b { color:red; } </style> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.3/require.min.js"></script> <script> require.config({ baseUrl: "./", packages: [ { name: "skylark", location: "../../../src/skylark" }, ] }); </script> </head> <body> <p><b>Test</b> Paragraph.</p> <p></p> <script> require(["skylark/query","skylark/finder", "skylark/datax"], function(query,finder, datax) { var str=datax.text(finder.find("p")); query("p:last").html(str); }); </script> </body> </html>