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

Popular posts from this blog

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

c# - ReportViewer control - axd url -

time series - R growth rate calculation week over week on daily timeseries data -