views:

152

answers:

2

Don't dismiss this as a newbie question! It's not, I'm not, I've tried everything, and its a complex/convoluted environment that my code is in.

Okay - here goes. I'm adapting someone else's html/js/css code and trying to get it to work on my server (I've taken permission - please, no comments on that). The main html generates a overlaid form which has a checkbox which is unchecked that I need to mark as checked before presenting to the user.

The checkbox code is just:

<input type="checkbox" id="type" />
<label for="type" id="disable">Disable check</label>

I've tried changing the above to ALL of the following (AND doing Ctrl+F5 when trying it out on the browser):

<input type="checkbox" id="type" CHECKED/>
<input type="checkbox" id="type" checked>
<input type="checkbox" id="type" checked="checked"/>
<input type="checkbox" id="type" checked="checked" value="1"/>
<input type="checkbox" id="type" value="true" checked>
<input type="checkbox" id="type" name="tempname" checked="checked"/>
<input type="checkbox" id="type" checked=true/>
At the end of the page: <script type="text/javascript">document.getElementById("type").checked=true;</script>

The problem COULD be elsewhere - something somewhere COULD be setting it to a default value of unchecked, but (a) thats a bit unlikely, and (b) I did look at the accompanying js code but no luck on a preliminary search.

Thoughts? 'cause I'm all out... :(

+1  A: 

Have you looked into the JavaScript to see if there is code that is marking the checkbox unchecked onclick?

+2  A: 

It's a fairly simple question, if only because checkboxes are fairly simple things :) If

<input type="checkbox" id="type" name="name" checked="checked"/>

doesn't work then I would strongly suggest taking a bigger dig through the javascript being loaded on the page.

Steerpike
Thanks Steerpike, austin cheney and KooiInc - all of you guys are right. When the overlay form was being loaded, somewhere in a 300kb compressed/obfuscated js file, a value on the form was being checked dynamically and this checkbox reset to the unset value...
Steve