Skip to content
Advertisement

Get the value of a radio input button using jQuery

I’m trying to get the value of the radio button that has been clicked, and I’m using the code below. But I’m getting the following error:

jquery-3.5.1.min.js:2 Uncaught TypeError: Cannot read property ‘toLowerCase’ of undefined

The code that I have used:

JavaScript

Advertisement

Answer

The issue is that you are using an arrow function, so this refers to whatever it refered to outside of that function (it won’t refer to the clicked element).

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement