| Author |
jQuery - For Loop question
|
Nakataa Kokuyo
Ranch Hand
Joined: Jul 24, 2011
Posts: 133
|
|
Good day,
I have an array('checkComponents ') which holding list of textbox input id, and i want to iterate it to get the user value that have been type but seem i didn't get my luck on it.
question : how to used jQuery to get user input value from an array that holding input component id?
Appreciated your help on this !
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56150
|
|
|
I'd use jQuery.map().
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Nakataa Kokuyo
Ranch Hand
Joined: Jul 24, 2011
Posts: 133
|
|
Thanks Bear and that's a good function, here is what i try but i get the value of "undefine"
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56150
|
|
You're not forming the selector correctly from the id values.
Also, alert is a dinosaur. At least open a JavaScript console and use console.log().
|
 |
Nakataa Kokuyo
Ranch Hand
Joined: Jul 24, 2011
Posts: 133
|
|
Thanks Bear for the clue
|
 |
Nakataa Kokuyo
Ranch Hand
Joined: Jul 24, 2011
Posts: 133
|
|
|
one extra question Bear, if we using console.log() , is it compatible to all browser and it won't caused any exception ?
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56150
|
|
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56150
|
|
Nakataa Kokuyo wrote:one extra question Bear, if we using console.log() , is it compatible to all browser and it won't caused any exception ?
It's not something that you'd leave in your code, just like you wouldn't leave in any debug alerts.
All modern browsers support some sort of JavaScript console, but a reference to console can fail if it's disabled (which it will be for most users).
|
 |
Nakataa Kokuyo
Ranch Hand
Joined: Jul 24, 2011
Posts: 133
|
|
|
Thanks again Bear, is there a chance to turn on the console automatically if it was off (probably from code call) ? the debug message is somehow useful when complicated JS function applied.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56150
|
|
No.
Would you really want the JavaScript console to pop open on a user whenever they visit your page?
|
 |
Nakataa Kokuyo
Ranch Hand
Joined: Jul 24, 2011
Posts: 133
|
|
|
make sense Bear , thanks again !
|
 |
 |
|
|
subject: jQuery - For Loop question
|
|
|