I'm trying to learn codeigniter and jquery. There is always a val() that nobody explains. What is it for?
+7
A:
When it comes to jQuery, it is all in the documentation.
Essentially, the val
function is to set or get the value of an element.
If you have an input field, like so:
<input name='my_field' id='my_field' value='Hello World'>
Then you can do this to get the value of the field:
var value = $('#my_field').val();
Or do this to set the value of the field:
$('#my_field').val('My new value');
Paolo Bergantino
2009-06-17 02:17:22
Where are the docs?
Delirium tremens
2009-06-17 02:18:08
He linked to the specific page.
BipedalShark
2009-06-17 02:21:25
see the link on the first line of the answer
Jimmy
2009-06-17 02:21:27