Setting CHECKED status on a Radio Button set.
Ok, I think I'm about to go out of my mind...
I've tried every single method I can find on the web to set the checked state of a JQuery radio button but none of them work. I've seen loads of methods, all slightly different and looking at them they all make sense.
I'm ok with setting checked status with normal radio buttons, but this just DOESN'T work for me.
Clearly I'm being an idiot and have missed something very obvious.
Here's my form for reference...
- <div id="monthSelect">
- <form name='monthSelectForm' id='monthSelectForm'>
- <input type="radio" id="selJan" name="ms" <%MthRadio("1")%> onclick="window.location='?ReportMonth=1';"/><label for="selJan">Jan</label>
- <input type="radio" id="selFeb" name="ms" <%MthRadio("2")%> onclick="window.location='?ReportMonth=2';"/><label for="selFeb">Feb</label>
- <input type="radio" id="selMar" name="ms" <%MthRadio("3")%> onclick="window.location='?ReportMonth=3';"/><label for="selMar">Mar</label>
- <input type="radio" id="selApr" name="ms" <%MthRadio("4")%> onclick="window.location='?ReportMonth=4';"/><label for="selApr">Apr</label>
- <input type="radio" id="selMay" name="ms" <%MthRadio("5")%> onclick="window.location='?ReportMonth=5';"/><label for="selMay">May</label>
- <input type="radio" id="selJun" name="ms" <%MthRadio("6")%> onclick="window.location='?ReportMonth=6';"/><label for="selJun">Jun</label>
- <input type="radio" id="selJul" name="ms" <%MthRadio("7")%> onclick="window.location='?ReportMonth=7';"/><label for="selJul">Jul</label>
- <input type="radio" id="selAug" name="ms" <%MthRadio("8")%> onclick="window.location='?ReportMonth=8';"/><label for="selAug">Aug</label>
- <input type="radio" id="selSep" name="ms" <%MthRadio("9")%> onclick="window.location='?ReportMonth=9';"/><label for="selSep">Sep</label>
- <input type="radio" id="selOct" name="ms" <%MthRadio("10")%> onclick="window.location='?ReportMonth=10';"/><label for="selOct">Oct</label>
- <input type="radio" id="selNov" name="ms" <%MthRadio("11")%> onclick="window.location='?ReportMonth=11';"/><label for="selNov">Nov</label>
- <input type="radio" id="selDec" name="ms" <%MthRadio("12")%> onclick="window.location='?ReportMonth=12';"/><label for="selDec">Dec</label>
- </form>
- </div>
The VBscript MthRadio() bits are a lame attempt to set the checked status manually - done out of desparation. It works but I REALLY don't want to do it that way as it's LAME and inflexible. I just want to do something noce and simple like:
- <script>
- $('input[name=ms]')[3].checked="checked";
- </script>
My VBScript 'cheat'...
- function MthRadio(Mth)
- if (session("ReportMonth")=Mth) then
- response.write "checked='checked' "
- end if
- end function