homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

selecting the entered text in an input form
Sarah Atkinson

10+ Year Member

Msg#: 4181201 posted 3:07 pm on Aug 3, 2010 (gmt 0)

I simply don't understand JavaScript one bit.

I made a small script in PHP and now i have to create the same script in javascript.

So I have a small form and when the form is submitted I want the value entered into the field to be sent to a function as a variable

$(document).ready(function() {
var enteredValue=$('input[name="x"]').value;
function grabvalue(value)

but this doesn't work played with it and all I can get is either [object Object] or undefined
What am I doing wrong?



WebmasterWorld Senior Member fotiman us a WebmasterWorld Top Contributor of All Time 5+ Year Member

Msg#: 4181201 posted 3:12 pm on Aug 3, 2010 (gmt 0)

Looks like you're using jQuery, so you'd want to use the val() method instead of a value property.

Try this:

var enteredValue=$('input[name="x"]').val();

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved