91-9990449935 0120-4256464 |
jQuery val()There are two usage of jQuery val() method.
Syntax: It is used to get value. It is used to set value. It is used to set value using function. Parameters of jQuery val() method
jQuery val() exampleThe val() method is primarily used to get the values of form elements. This method doesn't accept any arguments. This method returns a NULL when no option is selected and it returns an array containing the value of each selected options in the case of one or more selection. Let's see the example of val() method. Test it NowOutput: Let's see example of jQuery val() method with single and multiple select boxes. Test it NowOutput: jQuery val(value) exampleThis method is used to set a string of text, a number, an array of strings corresponding to the value of each matched element. This method facilitates you to set the value by passing in the function. Let's see the example of val(value) method. Test it NowOutput: Name:
Next TopicjQuery css()
|