Iterate Through Jquery Form Object to get inputs -


i'm passing jquery form object function. function should @ checkboxes , find id attribute.

i tried filter function. not seeing input fields.

function templateremove(form){      selectedtemplatesizes = [];      var selectedsizescount = 0;      form.filter(':input').each(function(i, e){         console.log($(e));         selectedtemplatesizes.push($(e).attr('id'));     });  } 

but nothing getting added array , nothing gets logged in console. call function follows:

 templateremove($( "#delete-selected-form" )); 

am not doing right?

use find instead of filter.. , works fine..

you can think of way : find - searches selected items matched elements, whereas filter removes unmatched elements selected..

templateremove($( "#delete-selected-form" ));  function templateremove(form){  selectedtemplatesizes = [];  var selectedsizescount = 0;    form.find(':input').each(function(i, e){     console.log($(e));     selectedtemplatesizes.push($(e).attr('id'));   });  } 

see fiddle: http://jsfiddle.net/jfit/m9qqx/


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -