I have the following input field

<input type="text" name="location[state_id]" id="location[state_id]" value="" >

and i am trying to assign there a value with the following jquery

$("#location\\[state_id\\]").val("5");

but it does not working! It works only if the name of both is only location.

Thanks

Edit
Report