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.
精彩评论