[jQuery] Re: looping through form elements.

2010-01-10 Thread MorningZ
$(':input').each(function(idx, item) { alert(idx); }); There are lots of form controls that aren't input elements. They are all in the form's elements collection. But the :input selector will also get non-input elements: http://docs.jquery.com/Selectors/input Overview: Matches all

[jQuery] Re: looping through form elements.

2010-01-09 Thread Rick van Hoeij
Well if you just want the element, you don't even need the :. Just $ ('input') would do the trick. Greetz, Rick On Jan 8, 9:35 pm, rich dottedq...@gmail.com wrote: Rick,      Thank you for your response.   I was able to figure out $ (this).val() grabbed the value and you explained  

[jQuery] Re: looping through form elements.

2010-01-09 Thread RobG
On Jan 8, 8:33 am, rich dottedq...@gmail.com wrote: Hello all, I'm relatively new to JavaScript.  I would like to loop through all the elements within a form and grab their values and what type of input they are.  So far I came up with: $(':input').each(function(idx, item) {      

[jQuery] Re: looping through form elements.

2010-01-08 Thread Rick van Hoeij
Hey, Maby this will help: $('.input').each(function(){ alert('Value: ' + $(this).val() + ' - Type: ' + $(this).attr ('type')); }); That should do the trick. Just let me know. Greetz, Rick On Jan 7, 11:33 pm, rich dottedq...@gmail.com wrote: Hello all, I'm relatively new to JavaScript.  I

[jQuery] Re: looping through form elements.

2010-01-08 Thread rich
Rick, Thank you for your response. I was able to figure out $ (this).val() grabbed the value and you explained $(this).attr should do the trick with grabbing what type the input element is. I appreciate your help. I had to change .input to :input since I'm filtering out by the element