Home >Web Front-end >HTML Tutorial >About the visibility problem of controls_html/css_WEB-ITnose

About the visibility problem of controls_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:23:121115browse

select control

2c5b56667d31e70da1c2e46d9366a648
5a07473c87748fb1bf73f23d45547ab8temporary4afa15d3069109ac30911f04c56f3338
5a07473c87748fb1bf73f23d45547ab8fixed4afa15d3069109ac30911f04c56f3338
18bb6ffaf0152bbe49cd8a3620346341
23d08b3dfb72c6b95270b6bcf523494d
5a07473c87748fb1bf73f23d45547ab814afa15d3069109ac30911f04c56f3338
5a07473c87748fb1bf73f23d45547ab824afa15d3069109ac30911f04c56f3338
5a07473c87748fb1bf73f23d45547ab83< ;/option>
18bb6ffaf0152bbe49cd8a3620346341
Then I get the value from the database. When the page is displayed, when the value of sel1 is temporary, the control sel2 is hidden
When the value of sel1 When it is fixed, control sel2 is in the display state.
Please ask God

Reply to the discussion (solution)

        $("#sel1").change(function () {            if ($(this).val() == "临时") {                $("#sel2").hide();            } else {                $("#sel2").show();            }        });

        $("#sel1").change(function () {            if ($(this).val() == "临时") {                $("#sel2").hide();            } else {                $("#sel2").show();            }        });

I know it can be written like this.
But I want to judge the value of sel1 taken out from the database when the page is loaded, and control the visibility of the sel2 control based on this value, not when the value of the sel1 control changes ----- --------Thank you

Then you can get the value of sel1 after the page is loaded
Java may be like this
window.onload=function(){
var sel1='${requestScope.name}';
if(sel1=='....'){
sel2.style.display='none';
}else{
. ...code
}
}


        $("#sel1").change(function () {            if ($(this).val() == "临时") {                $("#sel2").hide();            } else {                $("#sel2").show();            }        });

I know it can be written like this.
But I want to judge the value of sel1 taken out from the database when the page is loaded, and control the visibility of the sel2 control based on this value, not when the value of the sel1 control changes ----- --------Thank you

I don’t know what framework you are using. If it is mvc, get the value of sel1 from DB before return view(), and then stuff a viewBag or something like that. Go to the front desk and judge based on this. Personally I feel~~



        $("#sel1").change(function () {            if ($(this).val() == "临时") {                $("#sel2").hide();            } else {                $("#sel2").show();            }        });

I know it can be written like this.
But I want to judge the value of sel1 taken out from the database when the page is loaded, and control the visibility of the sel2 control based on this value, not when the value of the sel1 control changes ----- --------Thank you

I don’t know what framework you are using. If it is mvc, get the value of sel1 from DB before return view(), and then stuff a viewBag or something like that. Go to the front desk and judge based on this. Personally I feel~~

I use VB

The idea should be similar~~

The idea is It’s almost the same, but I just can’t turn my head around = =

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn