开发者

jquery say input[name=state] is null but not null

开发者 https://www.devze.com 2023-03-21 03:30 出处:网络
开发者_如何学Pythoni am create modal and incude input modal . <input type=\"hidden\" name=\"state\" id=\"state\" value=\"123\" />

开发者_如何学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 
    }
});
0

精彩评论

暂无评论...
验证码 换一张
取 消