A much neater way to do what you need is to use the Form Serializer. This allows you to get values of all the inputs at one go, and you can then submit them. And there is also a de-serializer plugin that allows you to set values from a JSON into the form.
The form serializer is in the svn version in form.js. The deserializer is in the plugins directory at
http://proj.jquery.com/plugins/
Regards
Ashutosh

On 8/12/06, Matt Stith <[EMAIL PROTECTED]> wrote:
jQuery might be a little slow for this need, try using regular DOM selectors, it would be faster and easier.

On 8/10/06, Chad Lansford < [EMAIL PROTECTED]> wrote:
I'm new to jQuery, and I'm having a problem grabbing the value from a textbox or textarea.

I searched the past discussions and found this issue:

http://jquery.com/discuss/2006-July/008603/

This is basically what's happening to me, but I couldn't find the resolution I was hoping for in the past discussions.  The interesting thing is that the same thing happens if I try to use "document.getElementById ('elemid').value;" - so... it may or may not be a jQuery issue at all.

Anyway, I'd appreciate any help you all could offer... I'm pulling my hair out...

Here's the code snippets:

HTML:

<input name="SendMessage1:hdnID" id="SendMessage1_hdnID" type="hidden" />
<input name="SendMessage1:hdnSID" id="SendMessage1_hdnSID" type="hidden" />
<input name="SendMessage1:hdnMessageType" id="SendMessage1_hdnMessageType" type="hidden" />
<input name="SendMessage1:txtMessageSubject" type="text" id="SendMessage1_txtMessageSubject" />
<textarea name="SendMessage1:txtMessageBody" id="SendMessage1_txtMessageBody"></textarea>
<input type="button" id="btnSubmit" value="Send Message" false;"/>

_javascript_:

function sendUserMessage() {
var id = $("#SendMessage1_hdnID").val();
var sid = $("#SendMessage1_hdnSID").val();
var type = $("#SendMessage1_hdnMessageType").val();
var subject = $("#SendMessage1_txtMessageSubject").val();
var body = $("#SendMessage1_txtMessageBody").val();

alert(id);  //returns correctly
alert(sid);  //returns correctly
alert(type);  //returns correctly
alert(subject);  //ONLY returns original value, not the updated text
alert(body);  //ONLY returns the original value, not the updated text

//test
alert(document.getElementById("SendMessage1_txtMessageSubject").value);  //ONLY returns original value, not the updated text
alert(document.getElementById("SendMessage1_txtMessageBody").value);  //ONLY returns original value, not the updated text
}

Chad

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/




_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/





--
Reach1to1 Communications
http://www.reach1to1.com
[EMAIL PROTECTED]
98201-94408
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to