javascript - Unable to change the visibility of HTML elements -


i trying change visisbility of row of elements. supposed display elements if user selects button.

html code :

  <tr style="display:none">       <td><input type="submit" value ="home" onclick="" id="home"/></td>       <td><input name="home_phone" id="home_phone" type="text" value="phone" ></td>   </tr> 

js code :

 document.getelementbyid("home").style.display = '';  document.getelementbyid("home_phone").style.display = ''; 

i trying achive using html , js .

you javascript code correct.

the problem setting display value element nested within hidden element. have change style of <tr> because hidden element.

html code:

<a href="javascript:togglerow('home_row');">toggle home row visibility</a>  <table>    <tr id="home_row">       <td><input type="submit" value ="home" onclick="" id="home"/></td>       <td><input name="home_phone" id="home_phone" type="text" value="phone" ></td>    </tr> </table> 

js code:

function togglerow(rowid){     var rowelement = document.getelementbyid(rowid);     rowelement.style.display = rowelement.style.display.tolowercase() == 'hidden'                                ? 'table-row'                                : 'hidden'; }  

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -