开发者

jquery selector on textarea and textbox

I have a div with ID as MQ , i have to get the values of textbox and textareas within this div id MQ using JQuery foreach . i have tried following , but no results.

$('div#MQ :text,textarea').each(function(){

$('div#MQ input[type="text开发者_运维知识库"],textarea).each

kindly let me know your suggestions.


Try something like this:

$('#MQ').find('textarea,:text').each( function(){
  var result = $(this).val(); // do something with each element's value
});


Try this, basically it will find text and textarea attributes within the #MQ div:

$('text,textarea', "#MQ").each(function(){

For an explanation of this syntax, please see jquery-this-syntax-question.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜