refresh <table> using AngularJS or javascript -


i'm struggling hours <table> refresh using onclick button. want refresh random values, once button clicked. i've set id="mytable" on <table> , used .reload() function, doesn't seem work. ideas?

demo on jsfiddle

html:

<table id='mytable'>      <tr>       <td id="rand1"></td>     </tr>      <tr>       <td id="rand2"></td>     </tr> </table>  <button onclick="parent.document.getelementbyid('mytable').reload()">refresh random</button> 

js:

var random = function() {     return math.random(); } document.getelementbyid("rand1").innerhtml = random(); document.getelementbyid("rand2").innerhtml = random(); 

try this

<html> <body> <table id='mytable'>  <tr>   <td id="rand1"></td> </tr>  <tr>   <td id="rand2"></td> </tr> </table>  <button onclick="rand1.innerhtml=math.random();rand2.innerhtml=math.random()">refresh random</button> </body> </html> 

Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -