How To Get The Selected RadioButton From A List Of Element IDs Using jQuery

I've been doing some work with jQuery lately and now that I've begun digging into it am truly impressed at how much you can do with it so easily. Here's a quick line of code that will take a string of element IDs belonging to RadioButtons, find the one that's selected, and display an alert box with it's value:

alert("Selected radio button value: " + $(radioButtonIds).filter(":checked").get(0).value);

The format of the string containing the RadioButton IDs would look something like this:

"#rdoFirstChoice, #rdoSecondChoice, #rdoThirdChoice"

Comments

Popular Posts

Resolving the "n timer(s) still in the queue" Error In Angular Unit Tests

How to Get Norton Security Suite Firewall to Allow Remote Desktop Connections in Windows

How to Determine if a Column Exists in a DataReader

Silent Renew and the "login_required" Error When Using oidc-client

Fixing the "Please add a @Pipe/@Directive/@Component annotation" Error In An Angular App After Upgrading to webpack 4