I have just tried to add value in Two Text boxes and want to display in third text box.and I also tried to call my JavaScript Function in ASP:TextBox.but the function is not properly. I have Attached my code below to it.
I want to know how to call JavaScript Function in ONCLICK Event on ASP:TEXTBOX
<body>
<form id="form1" runat="server">
<asp:TextBox ID="TextBox1" runat="server" ></asp:TextBox>
<asp:TextBox ID="TextBox2" runat="server" ></asp:TextBox>
<asp:TextBox ID="TextBox3" runat="server" onchange="javascript:addition(this)"> </asp:TextBox>
<br />
</form>
<script>
var text1 = document.getElementById('<%=TextBox1.ClientID%>');
var text2 = document.getElementById('<%=TextBox2.ClientID%>');
var text3 = document.getElementById('<%=TextBox3.ClientID%>');
var t1 = text1.value;
var t2 = text2.value;
var t3;
function addition(){
t3 = parseInt(tl).value + parseInt(t2).value;
document.getElementById('TextBox3').value = t3;
}
</script>
onblurevent.blurwas your answer ?!! as you accepted ! as you experienced thebluris not fire when you focusingTextBox3, it is not the thing as you requested,, anywayfocusin JQuery oronfocusinin JavaScript is your solution notblur!!