开发者

jquery selector on textarea and textbox

开发者 https://www.devze.com 2023-02-08 20:14 出处:网络
I have adiv 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.

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

精彩评论

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