0

Hello
The line of code below works, but I want to use a variable name for the name="1" part

    alert(document.querySelector('input[name="1"]:checked').value);

I currently have an id (string data type) stored in a variable:

currentarowID = tbl2.rows[i].id;

but I can't work out how to put currentarowID inside the document.querySelector part - so something like:

alert(document.querySelector('input[name=currentarowID]:checked').value);

Any help much appreciated.

1
Contributor
1
Reply
16
Views
1 Month
Discussion Span
Last Post by onetwothree
1

I used the below in the end:

$("input[name="+currentarowID+"]:checked").val(); 

which worked

Votes + Comments
Be sure to mark as solved.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.