jQuery get value of select onChange

0 votes
I was under the impression that I could get the value of a select input by doing this $(this).val(); and applying the onchange parameter to the select field.

It would appear it only works if I reference the ID.

How do I do it using this.
4 days ago in Web Development by gaurav
• 12,820 points
5 views

1 answer to this question.

0 votes

To get the value and text of a select element on change:

  1. Add a change event listener to the select element.
  2. Use the value property to get the value of the element, e.g. select. value .
  3. Use the text property to get the text of the element, e.g. select. options[select. selectedIndex]. text .
answered 4 days ago by rajatha
• 3,540 points

Related Questions In Web Development

0 votes
1 answer

How to get value of HTML Checkbox from onclick/onchange events?

Hello @kartik, Use the click event, which won't fire until ...READ MORE

answered Oct 7, 2020 in Web Development by Niroj
• 82,720 points
3,150 views
0 votes
1 answer

jQuery get value of selected radio button

Input Radio value Property Get the value of ...READ MORE

answered 4 days ago in Web Development by rajatha
• 3,540 points
6 views
0 votes
1 answer

Get checkbox value in jQuery

To get the value of the Value ...READ MORE

answered 4 days ago in Web Development by rajatha
• 3,540 points
6 views
0 votes
1 answer

Get checkbox value in jQuery

if you have set a class or id for it, you ...READ MORE

answered 4 days ago in Web Development by rajatha
• 3,540 points
5 views
0 votes
1 answer

jQuery get value of select onChange

Try the following lines of code- $('select').on('change', function() ...READ MORE

answered Feb 11 in Java by Soham
• 8,730 points
53 views
0 votes
1 answer

How to use jquery with asp.net ajax?

If you weren't aware, Microsoft is planning ...READ MORE

answered Oct 15, 2018 in IoT (Internet of Things) by Annie97
• 2,160 points
172 views
0 votes
1 answer

Is 'sparkline' a method?

I suggest you to check 2 things That jquery.sparkline.js is actually ...READ MORE

answered Nov 9, 2018 in Apache Spark by Frankie
• 9,830 points
572 views
0 votes
1 answer

What is the syntax of SELECT statement?

This statement is used to select data ...READ MORE

answered Nov 27, 2018 in Database by Sahiti
• 6,360 points
393 views
0 votes
1 answer

jQuery get value of select onChange

Try this- $('select').on('change', function() { alert( this.value ...READ MORE

answered 4 days ago in Web Development by rajatha
• 3,540 points
12 views
0 votes
1 answer

$("#select option:second").val() jquery - keep select second value of select box option

Yes, you want the special jQuery eq() selector. ...READ MORE

answered 5 days ago in Web Development by rajatha
• 3,540 points
5 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP