text


jQuery取DIV中的值

首先,你需要找到这个div对象。加个class或者id是最方便的: <div id="testdiv">fuck</div>  接下来,就可以用.text()方法来取值了: var myval = $("#testdiv").text(); alert(myval); .text()方法的官方API如下: Unlike the .html() method, .text() can be used in both XML and HTML documents. The result of the .text() method is a string containing the combined text of all matched elements. (Due to variations in the HTML parsers in …