Get value select option JavaScript

jquery,javascript

jQuery select option by value

Select elements typically have two values that you want to access. First there's the value to be sent to the server, which is easy: Example

<select id="myselect">
    <option value="1">Mr</option>
    <option value="2">Mrs</option>
    <option value="3">Ms</option>
    <option value="4">Dr</option>
    <option value="5">Prof</option>
</select>

How to get value select option by jquery

$( "#myselect" ).val();
// => 1

Get selected text JavaScript

$( "#myselect option:selected" ).text();
// => "Mr"

Ref:: learn jquery

Có thể bạn đã miss một số snippets code

Using promises to catch errors

Lodash sort - Test performance with native js

Lodash sort - Bài viết ngắn gọn muốn đưa ra con số sau khi test về Lodash và Native js. Đây chỉ là check trên phương diện cá nhân...

Fix google adsense làm web chậm!

Sủ dụng google adsense chắc chắn gây cho hệ thống web wordpress của bạn bị chậm rất nhiều. Điều đó là điều đương nhiên, và đây là cách khắc phục.

void 0 js

The void operator evaluates the given expression and then returns undefined.

parse javascript Example

The JSON.parse() method parses a JSON string, constructing the JavaScript value or object described by the string