所以我的代码中有这个动态html。
$('#chat-box').html(
'<div id="chat-box-msg" style="height:225px;overflow:auto;">' +
'<p id="hidepara">Have a question? Let\'s chat!</p><p>Enter your Name & Question in the field\'s below and press ENTER.</p>' +
'<p style="margin-top:10px;">Enter Your Name</p><input type="text" id="chat-box-name" style="border:1px solid #0354cb;border-radius: 3px;width: 100%;height:30px;" class="chat-editing" /></div>' +
'<div id="chat-box-input"><textarea id="chat-box-textinput" style="width:100%;height:45px;border:1px solid #0354cb;border-radius: 3px;" /></div>'
);
这个id做些什么来获取文本
var todos = $('#chat-box-msg').text();
我想知道如何获取id的所有html"chat-box-msg"
并隐藏具有id的段落的文本"hidepara"
。因此,简而言之,我想要除具有id的那个之外的所有div的html "hidepara"
,
别太苛刻,我是newbie
jquery。
非常感谢
尝试排除所需的元素,然后仅从.text()
过滤后的集合中调用函数,
var text = $('#chat-box-msg').children(':not("#hidepara")').text();
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句