Home >Web Front-end >JS Tutorial >Use name to get the select value

Use name to get the select value

php中世界最好的语言
php中世界最好的语言Original
2018-03-23 09:58:122801browse

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=&#39;address&#39;></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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn