Home >Web Front-end >JS Tutorial >Use name to get the select value
This time I will bring you the precautions for using name to get the select value and the precautions for using name to get the select value. The following is a practical case, let's take a look.
The example is as follows:
<select name="region[province]" id="" class="region valid"> <option value="0" selected="selected" tier="1">省、直辖市</option> <option tier="1" value="2">北京市</option> </select> var province = $("select[name='region[province]']").val(); 取得textarea的值 <textarea id='address'></textarea > $("#textarea ").val()
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other php Chinese websites related articles!
Recommended reading:
Detailed explanation of code optimization for javascript
CSS3 to achieve tilt and rotation animation effects
The above is the detailed content of Use name to get the select value. For more information, please follow other related articles on the PHP Chinese website!