StupidBeauty
Read times:749Posted at:Sat Jul 6 02:23:25 2013
- no title specified

转载 jQuery中没有innerText、innerHtml

使用jquery选择器获取到的对象,没有innerHTML属性,要想改变其内部文字代码的话,直接使用其html方法,例如$(“#t”).html(“New Text”).

http://azrael6619.iteye.com/blog/767118

亮点

document.getElementById("t") 获得的是dom对象,所有对象都有innerHTML
$("#t")获得的是jquery对象,无innerHTML

所以我们可以这样使用:

$("#t").html("sdsds");
or
$("#t")[0].innerHTML="sdsds";

如果是innerText,也类似就是把html改成Text即可。

未知美人

Your opinions
Your name:Email:Website url:Opinion content:
- no title specified

HxLauncher: Launch Android applications by voice commands

 
Recent comments
2017年4月~2019年4月垃圾短信排行榜Posted at:Thu Sep 26 04:51:48 2024
Qt5.7文档翻译:QWebEngineCookieStore类,QWebEngineCookieStore ClassPosted at:Fri Aug 11 06:50:35 2023盲盒kill -9 18289 Grebe.20230517.211749.552.mp4