javascript - want to display one specific row with one radio button select and hiding otherone -


here have 2 radio buttons,what want if select radio button student class row should visible else profession row visible. @ time 1 row visible.

<tr><td>member</td>     <td><input type="radio" name="member" value="student" onclick = "select_mem()">student<br></td>     <td><input type="radio" name="member"  value="parent" onclick = "select_mem()">parent<br></td></tr> <tr><td>class</td>     <td><select name="class" style="width:50px" >         <option value="1">i</option>         <option value="2">ii</option>         <option value="3">iii</option>         <option value="4">iv</option>         <option value="5">v</option></select></td></tr> <tr><td>profession</td>     <td colspan="2"><input type="text" name="prof"</td></tr> 

i tried use java script

function select_mem() {     var stu= $('input:radio[name=member]:checked').val();     document.write(stu);  } 

here trying stu value see , can put if condition. please me how it

this should help

<tr><td>member</td>     <td><input type="radio" name="member" value="student" onclick = "select_mem(this.value)">student<br></td>     <td><input type="radio" name="member"  value="parent" onclick = "select_mem(this.value)">parent<br></td></tr> <tr id="cls"><td>class</td>     <td><select name="class" style="width:50px" >         <option value="1">i</option>         <option value="2">ii</option>         <option value="3">iii</option>         <option value="4">iv</option>         <option value="5">v</option></select></td></tr> <tr id="pro"><td>profession</td>     <td colspan="2"><input type="text" name="prof"</td></tr>  function select_mem(val) {     if ( val == "student" ){         document.getelementbyid("cls").style.display = "table-row";         document.getelementbyid("pro").style.display = "none";     } else {         document.getelementbyid("cls").style.display = "none";         document.getelementbyid("pro").style.display = "table-row";     } } 

Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -