mardi 21 août 2018

dropdown value change based on checkbox we select

I want the colour options in the dropdown should change depending on the gender selected. means for Male:(White, Black, Red, Grey); and for Female: (White, Black). how to do this? i dont have an idea about it. should i use javascript and if yes the how to implement it in my code?

<!doctype html>

<html lang="en">
<head>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Form Submission </title>
  <link rel="stylesheet" type="text/css" href="css/style.css">
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
    <script type="text/javascript" src="jquery-3.3.1.min.js"></script>
  <script type="text/javascript">

</script>
  </head>
<body>
    <header></header>
    <h2> Submit Your Design</h2>
    <div class="MainForm">
    <form action="" method="post">

           <div class="fullForm">
      Name:<input type="text" name="name" size="40px" required><br>

      Email:<input type="email" name="email" placeholder="" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$" size="40px" required><br> 

    Design Title:<input type="text" name="name" placeholder="" size="40px" required><br>

    Gender<input type="radio" name="gender" value="1" checked/>Male <input type="radio" name="gender" value="2" id="myCheck"  onclick="myFunction()" />Female <br />

    Color: <select name="color" id="text"> 

  <option value="" disabled selected>Select Tee Color</option>
<option value="volvo">White</option>
  <option value="saab">Black</option>
  <option value="mercedes">Red</option>
  <option value="audi">Grey</option>
</select><br>


Start Campaign Immediately?<input type="checkbox" name="gender" value="1"/><br>
   <input type="submit" name="submit" value="submit" class="btn11">
        </div></form></div>

        </body></html>




Aucun commentaire:

Enregistrer un commentaire