Javascript function not firing from button click -
i have following html:
<input type="text" id="theinput" /> <input id="clickme" type="button" value="search" onclick="testfunction(document.getelementbyid('theinput').value)" /><br>
i trying trigger this:
function testfunction(data) { alert(data); }
i tried alternative, using:
document.getelementbyid("clickme").onclick = testfunction(document.getelementbyid("theinput").value);
sadly, neither of these methods seem function trigger. i'm sure missing simple, point out, please?
i have test , found code ok, can see demo here. however, think not work in page because of way include javascript functions. have better put scripts in head
tag of page.
if use framework, make sure functions , bindings executed when javascript loaded.
Comments
Post a Comment