If your text boxes and textareas all have 'name' attributes, you could
just ask the values() plugin to find them all for you:

// vals will be an object with the names as keys and the values as, well, values
var vals = $('form').values();

http://code.google.com/p/jquery-values/

On Sat, Jul 11, 2009 at 11:12 AM, barun<barun.sah...@gmail.com> wrote:
>
> Thanks, Rick! That's an excellent example, and I could achieve my
> functionality with that. However, I would like to know if we could
> access the value with the text box name also. For example, if we know
> that the text box's name is text_1, then we could use like:
>
> $("form input#text_1").attr("value");
>
> In this case the name is dynamically generated. So, I tried with
>
> txt_name = "text_" + i;    // i is a counter
> $("form input#" + txt_name).attr("value");
>
> But this doesn't seem to work. Any syntactical error?
>
> This way of working would be useful in other cases too. For example,
> if we want to know the value of the i-th text box.
>
> Thanks,
>
> Barun.
>
> On Jul 11, 8:36 pm, Rick Waldron <waldron.r...@gmail.com> wrote:
>> When the user specifies the textareas, assign them a special "logic"
>> classname... like "user-textarea"
>> I put together an example:
>>
>> http://jsbin.com/oqomi
>>
>> Rick
>>
>> On Sat, Jul 11, 2009 at 10:25 AM, barun <barun.sah...@gmail.com> wrote:
>>
>> > Hi All,
>>
>> > There are n text boxes having names: text_1, text_2, text_3,  ....
>> > Now, this number n is not fixed. User specifies how many text boxes he
>> > wants. I want to display their values on a button click event. How
>> > should I do that?
>>
>> > Thank you for all of yours suggestions!
>>
>> > Barun.
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-dev@googlegroups.com
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to