jquery say input[name=state] is null but not null
开发者_如何学Pythoni am create modal and incude input modal .
<input type="hidden" name="state" id="state" value="123" />
but output $('#state').val() is null
$(document).ready(function()
{
if ( $('#state').val() == '')
{
alert('null') // input is full but return null
}
else
{
alert('not null') // runing else
}
}
Doesn't behave like that to me.
However, try this:
$(document).ready(function(){
if ( $('#state').val() == '')
{
alert('null'); // input is full but return null
}
else
{
alert('not null'); // runing else
}
});
精彩评论