Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

116
Views
variable forms with a dropdown menu

I have made an dropdown within my form. When I choose one of the dropdown options, another form will appears. So with each dropdown option, there is another form.

I made From1 and added a CSS with opacity = 0. When I click in my dropdown on 1, I want to set the opacity of Form1 to opacity=1;

my code;

<select id="products" onchange="test">
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    <option value="4">4</option>
    <option value="5">5</option>
    <option value="6">6</option>
 </select>

<form id="Form1">
    
    <text>Primary side </text>

</form>    



<script type="text/javascript">
function test()
{
    var a = document.getElementById("products").value;
    if(a ==='1'){
     var document.getElementById("Form1").style.opacity =1;
    }
    else if(a==="2")
    {
        var 
    }
    else if(a==="3")
    {
        var
    }
    else if(a==="4")
    {
        var
    }
    else if(a==="5")
    {
        var
    }
    else if(a==="6")
    {
        var
    }
}
</script>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

your opacity change statment is correct except the var. You are not declating anything.

change var document.getElementById("Form1").style.opacity =1;

to document.getElementById("Form1").style.opacity =1; in your if statment and assuming your if statments constraint passes the opacity will change.

BONUS: I reccommend you set the display to none and change the display propery when you want to display it instead of manipulating opacity.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!