javascript - jquery - identify items by class and then extract value -


i have following hidden input field on form:

 <input class="dow" id="hidden_dow0" type="hidden" value="m,t,w,r,f,s,n"> 

once form has loaded need find hidden control, extract value... , use each item in list ('m,t,w ') set corresponding checkboxes on

so far, have been able find hidden inputs, don't know how extract value it.

here's have far:

$('.dow ').each(function (i, row) {         var $row = $(row);           var $ext = $row.find('input[value*=""]');         console.log($ext.val);  //fails.     }); 

edit 1

this tried:

//find items have class "dow" ... ,  $('.dow ').each(function (i, row) {     var $row = $(row);     console.log(i);     console.log(row); //prints <input> control     //var $ext = $row.find('input[value*=""]');     var $ext = $row.find('input[type="hidden"]');     console.log($ext); //prints object     $ext.each(function() {         console.log( $(this).val() );  //does not work     }); }); 

in jquery val() function.
.dow element is input, don't need find it

$('.dow ').each(function (i, row) {     console.log( $(this).val() );  //works }); 

Comments

Popular posts from this blog

sql server - Cannot query correctly (MSSQL - PHP - JSON) -

php - trouble displaying mysqli database results in correct order -

C++ Linked List -