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.

I used the below in the end:

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

which worked

commented: Be sure to mark as solved. +15
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.