Hi everyone,

I found one way to do this, and it is only a few lines.  This is my
first use of JQuery so can anyone comment on whether there is a better
way?

<script type="text/javascript">
$(document).ready(function() {
        $("input:radio").click(function() {
                thisClass = $(this).attr("class");
                $("." + thisClass).filter(":radio").attr('checked', false);
                $(this).attr('checked', true);
        });
})
</script>

<form>
<table>
<tr>
        <td><input type="radio" name="row1" value="row1col1"
class="q123col1"></td>
        <td><input type="radio" name="row1" value="row1col2"
class="q123col2"></td>
        <td><input type="radio" name="row1" value="row1col3"
class="q123col3"></td>
</tr>
<tr>
        <td><input type="radio" name="row2" value="row2col1"
class="q123col1"></td>
        <td><input type="radio" name="row2" value="row2col2"
class="q123col2"></td>
        <td><input type="radio" name="row2" value="row2col3"
class="q123col3"></td>
</tr>
<tr>
        <td><input type="radio" name="row3" value="row3col1"
class="q123col1"></td>
        <td><input type="radio" name="row3" value="row3col2"
class="q123col2"></td>
        <td><input type="radio" name="row3" value="row3col3"
class="q123col3"></td>
</tr>
</table>
</form>

Thanks

PKJ

Reply via email to