How to get values in hidden fields by jquery
Xiaobian to share with you how jquery to get the value of hidden fields, I believe most people still do not know how to share this article for your reference, I hope you have a lot of harvest after reading this article, let's go to understand it together!
jquery Methods to get hidden field values: 1. Use "$("input:hidden")" statement to get hidden field nodes;2. Use val() method to get hidden field values, syntax "hidden field node.val()".
This tutorial operates on Windows 7, jquery version 1.10.2, Dell G3 computers.
hidden field
Hidden fields are invisible to users on the page, and are inserted into forms to collect or send information for use by programs that process the form. When the viewer clicks the Send button to send the form, the hidden field information is also sent to the server.
In jquery, val() method can be used to get values in hidden fields.
val() returns or sets the value of the selected element.
The value of an element is set through the value attribute. This method is mostly used for input elements.
If the method has no parameters set, it returns the current value of the selected element.
Acquiring Value Syntax:
$(selector).val()
Examples:
$(document).ready(function() { $("button").click(function() { var value = $("input:hidden").val(); alert(value); }); });
Gets the value of the hidden field
The above is "jquery how to get hidden field values" all the content of this article, thank you for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to the industry information channel!