get selected option attribute value jquery

This method does not accept any arguments. How to Find an Element Based on a Data-attribute Value in jQuery. How to Get the Value of Selected Option in a Select Box Using jQuery. The above example gives the HTML content with the HTML tags on alert. About using tag property in C# treeview. // Get the value from the selected option in a dropdown, // Get the value from a dropdown select directly, // Get the value from a set of radio buttons, "https://code.jquery.com/jquery-3.5.0.js". As of jQuery 1.4, the function is passed two arguments, the current element's index and its current value: This example removes leading and trailing whitespace from the values of text inputs with a "tags" class. Used Function: For example: Note: At present, using .val() on