0

i'm attempting to put a value from a text box into a variable

text box looks like so:

<input type="text" size="30" name="group1name" value="Group 1" id="g1n">

pulling looks like so:

var group1name = $('#g1n').attr('value');

it will pull "Group 1" but if i change the text box it still pulls "Group 1" how can i make it pull the CURRENT value of the text box?

2 Answers2

1
var group1name = $('#g1n').val()

simple.

ProllyGeek
  • 15,517
  • 9
  • 53
  • 72
1

var group1name = $("#g1n").val();

Baked Inhalf
  • 3,375
  • 1
  • 31
  • 45