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
Release: 2016-06-24 12:23:12
Original
1105 people have browsed it

select control



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();            }        });
Copy after login
Copy after login
Copy after login
Copy after login

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

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();            }        });
Copy after login
Copy after login
Copy after login
Copy after login

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();            }        });
Copy after login
Copy after login
Copy after login
Copy after login

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 = =

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template