Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

selecting the entered text in an input form


Sarah Atkinson

3:07 pm on Aug 3, 2010 (gmt 0)

10+ Year Member

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?


3:12 pm on Aug 3, 2010 (gmt 0)

WebmasterWorld Senior Member fotiman is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

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();

Featured Threads

Hot Threads This Week

Hot Threads This Month