If the given attribute does not exist, the value returned will – PointyJul 25 '18 at 12:25 The getAttribute () method returns the value of the attribute with the specified name, of an element. So the value of the selected option can be obtained in JavaScript … jQuery offers various method to get data attribute values, Here You can learn two simple method to get data-any attribute of selected html Elements. Getting Element's Attribute Value. What I love so much about JavaScript is that the language is incredibly dynamic. Description: An attribute. Remarks. We can get the value of text input field using various methods in script. Get the value of the class attribute of an