开发者

How do you store the visibility of a form into a variable in jquery?

开发者 https://www.devze.com 2023-01-13 05:31 出处:网络
how do we check whether a input box is visible or not....then store its state into variable to be outpu via alert ?

how do we check whether a input box is visible or not....then store its state into variable to be outpu via alert ?

right now i'm using and i think it wrong. can any body help ?

<inpu开发者_运维百科t type="hello" name="hello" value="" style="visibility:hidden"/>

function testhideinput(){
            var $input_state = $('input:text[name=hello]').is('visibility');
alert($input_state);
}


Try it like this.

var $input_state = $('input:text[name=hello]').is(':visible');

That's how it works in my code for a div.


var inputState = $('input:text[name=hello]').css('visibility');

if(inputState == "hidden") {
    // do stuff
}
else {
    // do some other stuff
}
0

精彩评论

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

关注公众号