jquery - Javascript onchange select list -


please can help?

i have below select list:

<td>call lead type: </td> <td>     <select name="callleadtype" id="callleadtype">         <option value=""></option>         <option value="lsg service warm transfer claims">lsg service warm transfer claims</option>         <option value="ivr direct call">ivr direct call</option>         <option value="transfer ee agent">transfer ee agent</option>         <option value="dropped line">dropped line</option>         <option value="test call ee">test call ee</option>     </select> </td> 

when user selects "transfer ee agent" need 4 new input boxes appear not appear when of other options selected?

so assume it's onchange code needs?

i'm not sure how

thanks in advance help

padders

you require javascript code display other fields when specific value selected in combo box. have used simple javacript code can understand quickly.

first add other fileds within table , hide them style property display:none

 <tr id="other_fields" style="display:none">         <td>other fields</td>         <td>               <input type="text" value="field1"/>               <input type="text" value="field2"/>               <input type="text" value="field3"/>               <input type="text" value="field4"/>              </td>   </tr> 

i have assigned row id other_fields, in onchange event if value matches required 1 show otherwise hide it.

secondly, add following javascript function , call in on load function. attach ebent handler select box.

<script type="text/javascript"> function onload() {    document.getelementbyid("callleadtype").onchange = function (e) {        if (this.value == 'transfer ee agent') {           document.getelementbyid("other_fields").style.display="";        } else {           document.getelementbyid("other_fields").style.display="none";           }   };  } </script> 

finally in body tag call function:

<body onload="onload()"> 

see working example at:

http://jsfiddle.net/ypvge/1/

hope helps


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

keyboard - C++ GetAsyncKeyState alternative -

android - java.net.UnknownHostException(Unable to resolve host “URL”: No address associated with hostname) -