I am trying to call a simple JavaScript function on the OnClientClick event, the function executes good in Firefox and IE10 but not at all working in Chrome and opera. I have checked the settings in Chrome V33 and Opera V15 and JavaScript is enabled in it.
This is button declaration in .aspx page
<asp:Button ID="Button2" runat="server" OnClientClick = "getValue()" OnClick="Button2_Click" Text="Label to Textbox" Width="135px" />
This is the button server side onClick event
protected void Button2_Click(object sender, EventArgs e)
{
string script = "alert(\"Hello!\");";
ScriptManager.RegisterStartupScript(this, GetType(),"ServerControlScript", script, true);
}
This is the function
document.getElementById('TextBox1').value = document.getElementById('Label2').innerHTML;
alert("foo");
Any assistance will be appreciated, Thank you.