Search the Community
Showing results for tags 'activate multiple elements'.
-
<html> <head> <script type="text/javascript"> function CheckColors(val){ var element=document.getElementById('color-test'); if(val=='pick a color'||val=='others') element.style.display='block'; else element.style.display='none'; } </script> </head> <body bgcolor='lime'> <div style="margin-left: 400px; margin-top:100px; width: 200px; height: 200px; border: solid blue 1px; display: inline-block; float: left;"> <p style=""> name </p> <p style=""> ball </p> <p style=""> color </p> </div> <div style="margin-left: 50px; margin-top:100px; width: 200px; height: 200px; border: solid blue 1px; display: inline-block; float: left;"> <p><input type ="text" ></p> <p><input type ="text" ></p> <select name="color" onchange='CheckColors(this.value);'> <option>pick a color</option> <option value="red">RED</option> <option value="blue">BLUE</option> <option value="others">others</option> </select> <p><input type="text" name="color" id="color-test" style='display:none;'/></p> </div> </body> </html> I created an example script of a situation I would like to solve. There are 2 divs. The right div receives an extra input field when onChange detects an event. In the left div there should also be a new html element like <p>. How can I program this with javascript?
- 2 replies
-
- onchange
- activate multiple elements
-
(and 2 more)
Tagged with: