I am trying to pass the value of a variable from javascript to C#.
Here is the client side part:
<input type="text" value="1" id="h" name="n" runat="server" />
<script>
$("a").on("tap", function (event) {
var a = event.target.id;
$("#h").val(a);
});
</script>
and the server side part:
<%
string param = h.Value;
Response.Write(param);
%>
The input field has an initial value=1. A JQuery event changes the value attribute to, let's say, 5. When I try to access the value of input from server side (h.Value), the value is again, 1.
What am I doing wrong?
Thank you.