Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Get value of inputs with Jquery
Old 03-06-2010, 01:52 PM Get value of inputs with Jquery
Junior Talker

Posts: 1
Trades: 0
I have 100 inputs with name - table[].
How to get their value with jQuery,like $_POST['table'] ,as I do in PHP.
I tryed
Code:
$("input[name='table[]']").each(function() {
	document.write($(this).val());
	
		
});
but I want to get them as an array.
lam3r4370 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-06-2010, 05:32 PM Re: Get value of inputs with Jquery
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
As soon as you select it, it's already an array. For example, you could do this:
Code:
var inputs = $("input[name='table[]']")
for(var i = 0; i < inputs.length; i++) {
    document.write(inputs[i].value);
}
The only disadvantage of doing it this way is if you select a member through its index, you can't chain special jQuery methods to it, such as .each(), or .val().

jQuery selection always returns an array, even if it is only one member. The value of each index in the array is the "raw" DOM object. For example:
Code:
alert($('#unique').html());
is the same as:
Code:
alert($('#unique')[0].innerHTML);
__________________
Join me on
Please login or register to view this content. Registration is FREE

Last edited by wayfarer07; 03-06-2010 at 05:34 PM..
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Reply     « Reply to Get value of inputs with Jquery
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.30022 seconds with 12 queries