Set hidden field's value on button's click in Jquery
Introduction : In this i will show you how to set value of hidden field's value on button click usinng Jquery . It is very easy to set value of hidden field's value using Jquery .I have written two way to set value of hidden field using Jquery . In first way you can write code in $(document).ready() function and second you can directly assign to on click of button .
HTML Code for Set hidden field's value on button's click in Jquery :
Introduction : In this i will show you how to set value of hidden field's value on button click usinng Jquery . It is very easy to set value of hidden field's value using Jquery .I have written two way to set value of hidden field using Jquery . In first way you can write code in $(document).ready() function and second you can directly assign to on click of button .
HTML Code for Set hidden field's value on button's click in Jquery :
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="JqueryValidation.aspx.cs" Inherits="HamidSite.JqueryValidation" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <script src="Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script> <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script> <script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script> <script src="Scripts/jquery.validate.js" type="text/javascript"></script> <script type="text/javascript" > $(document).ready(function () { $("#submit1").click(function () { $('#hiddenTest').val('Test-2'); alert($('#hiddenTest').val()); }); }); </script> </head> <body> <form id="form1" runat="server"> <div> <input type="hidden" id="hiddenTest" value="" /> <input id="submit" type="submit" value="test-1" onclick="$('#hiddenTest').val('Test-1');alert($('#hiddenTest').val());" runat="server" /> <input id="submit1" type="submit" value="test-2" runat="server" /> </div> </form> </body> </html>
ReplyDeleteFeel free to suгf to mу weblog Http://Syndicateapps.Info
Great Explanation.
ReplyDeleteJavaScript Training
JavaScript Training in Chennai