on-internet
← Community

jQuery select2 get value of select tag?

Stack Overflow ·

Hello friends this is my code: <select id='first'> <option value='1'> First </option> <option value='2'> Second </option> <option value='3'> Three </option> </select> This is my select2 code: $("#first").select2(); Below is code for getting selected value. $("#first").select2('val'); // It returns first,second,three. This is return a text like first,second,three and I want to get 1,2,3. Means I need the value of select box, not text.

Comments

Sign in or sign up to comment and upvote.

No comments yet.