jquery - Select inputs from only one form -


i have 2 forms on page:

<form id="form2070" name="form2070" class="myform"></form> <form id="formu2070" name="formu2070" class="myform"></form> 

from first form, i'd select input fields. if (sw 2070, checked):

var child = $('#form'+sw+' input'); 

it selects input-fields on page, second form. doing wrong (obviously, what?)

secondly, need type='text' fields form. i'm looping trough array find them:

$(child).each(function(){   if( $(this).prop('type')=='text' ){   //do   } } 

i tried using $('#form1 input[type="text"]') didn't work. there way filter them out in 1 statement?

[update][solved] problem solved. altough both forms propperly closed, left 1 <div> inside first form without corresponding </div>, messing up.

thanks suggestions , help!

try this,

$('document').ready(function(){     var sw = 2070   var child = $('#form'+sw+' input[type="text"]'); $(child).each(function(i){     alert($('input:eq('+i+')').val()); });  }); 

here demo url http://jsfiddle.net/mkqb6/


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -