node. Get their value and pass it to the value method ListBox adds the multiple attribute, and supports an array or list for the selected values (both helpers call the same code to render). mdbootstrap multiselect. The value can be either a string ('elem_1') matching the value of the option oran Array of values (['elem_1', 'elem_42']). Language. )I try get values with JQuery:$('element:selected').val()$('element:selected').text()But I do nothing Consider the HTML block below:
Then $('.block').first().index(); returns 1 because If no argument is passed to the .index() method, the return value is an integer indicating the position of the first element within the jQuery object relative to its sibling elements. If you are just showing a list of text values with no id … Now enhanced with: Conversational UI; Online Training; Document Processing Library; Embedded Reporting for web and desktop; Web. You can use the jQuery :selected selector in combination with the val () method to find the selected option value in a select box or dropdown list. I think you meant either one of those values, in that case var arr = ['bat', 'ball']; var selectors = arr.map(function(val) { return ':contains(' + val + ')' }); var $lis = $('ul li').filter(selectors.join()); $lis.css('color', 'red')