The code $( "div.demo-container" ).text() would produce the following result:. The jQuery attr() method is used to get or set attributes and values of the selected html elements. Note: Click the below buttons and get Data id and text. Each jQuery object also masquerades as an array, so we can use the array dereferencing operator to get at the list item instead: 1 console .log( $( "li" )[ 0 ] ); < option value = "5" > Prof If you wanted to get the string "Mr" if the first option was selected (instead of just "1") you would do that in the following way: Note: Click the below buttons and get Data id and text. Get the combined text contents of It is 2019 and there's a better way to do this: const form = document.querySelector('form'); const data = new URLSearchParams(new FormData(form).entries()); I wonder that everyone has posted about value and text option to get from