Hi guys i am new to jquery.
I am trying a simple addition in jquery. i have two input fields and in jquery i want to add numbers in these field. but add button is not triggering.
JQuery
<script type="text/javascript">
$(document).ready(function () {
//toggle div start
$("#btn_do").click(function () {
$(".div_chat").animate({
width: "toggle"
});
});
// toggle div end
//Add button click
$("btnplus").click(function () {
alert("sdfdf");
var val1 = $("#lblvalue1").val();
var val2 = $("#lblvalue2").val();
var added = parseInt( val1 )+ parseInt( val2);
alert(added2);
$("lbltext").val(added);
});
//add button click end
});
</script>
HTML
<form id="form1" runat="server">
<noscript>
<div>
You must enable javascript to continue.
</div>
</noscript>
<div>
<asp:Label ID="lblLabel" runat="server"></asp:Label>
<button id="btn_do" type="button">toggle</button>
</div>
<div></div>
<div id="divchatID" class="div_chat" style="height: 500px; width: 500px; background-color: #82adf2; display: none; padding:5px;">
<label id="lblvalue1">Value 1</label>
<input id="value1" type="text" onkeypress='return event.charCode >= 48 && event.charCode <= 57' />
<br />
<label id="lblvalue2">Value 2</label>
<input id="value2" type="text" onkeypress='return event.charCode >= 48 && event.charCode <= 57' />
<button id="btnplus" type="button" > ADD</button>
<br />
<asp:Label ID="lbltext" runat="server">tesst</asp:Label>
</div>
</form>
anyone? thanks in advance.
$("btnplus").click(function () {need to be$("#btnplus").click(function () {. TYPO?