set an input value from jquery function
- by user1499220
I'm simply trying to set a value for an input but it doesn't work. Here is my jquery function :
function display_form()
{ try {
$('#start_date').val('2012/08/21');
}catch (e){
alert('error');
}
window.alert( $('[name=start_date]').val() );
}
This shows "undefined".
Here is my form :
<input id="start_date" name="start_date" type="text" size="6" />
Should I put somewhere the id of the form that I want to use? I just followed what is said in the documentation of jquery but it doesn't seem to work.
Could anyone help me ?