I have a table which has a series of rows having ids like this: <tr id="XYZ101a"> <tr id="PDQ101a">
Each row has several radio buttons representing answers in an online survey named like so: <input type="radio" id="XYZ101a1"> <input type="radio" id="XYZ101a2"> <input type="radio" id="XYZ101a3"> <input type="radio" id="XYZ101a4"> <input type="radio" id="XYZ101a9"> There are many such table rows, and all that ever changes in their ids is the initial portion. (There's an ABC101a, a PDQ101a, etc). I am not allowed to change the input ids, as they are created in another department to adhere to some standardized schema. The answers always follow the format, too, and the answers ending with "9" are "Not applicable". I'm stuck on my task, which is to hide the question if "Not applicable" is chosen. In other words, my task is to notice whenever someone clicks on the last answer, which always ends in "9", and then use that selector to hide the whole row, which has as its ID the first portion of the id of the radio button ending in "9". So far I can react when the radio id ending in "9" is chosen using: if( $('input[id$=9]').is(":checked") ) { //hide the whole row in which this question resides} However, how can I grab the FIRST portion of the input id, which matches the row id I then need to hide? In perl, I'd use $' to represent the portion BEFORE the part I matched. How can I do this in jQuery? Any assistance appreciated. I don't seem to quite grok what jQuery does with its temp variables once a match is found. Thanks.