SitePoint Sponsor |
|
User Tag List
Results 1 to 5 of 5
-
Jun 21, 2006, 12:49 #1
- Join Date
- Sep 2004
- Location
- Toronto
- Posts
- 795
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Checkbox is Checked when text is clicked
Think about a situation like so...
<input type="checkbox" /> I agree to the terms of service
Now when the user clicks on the checkbox it is checked ( or unchecked if already checked ), but when the text is clicked nothing happens ( there is no link or javascript listeners attached to it ).
So I was wondering, using standard HTML tags, is it possible so that when the text is clicked then the checkbox is checked? Is this possible to do without using javascript?I can't believe I ate the whole thing
-
Jun 21, 2006, 13:46 #2
- Join Date
- Mar 2006
- Posts
- 18
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
HTML Code:<input type="checkbox" name="foo" id="foo" /><label for="foo">I agree to the terms of service</label>
-
Jun 21, 2006, 13:58 #3
- Join Date
- May 2006
- Location
- Phoenix, AZ
- Posts
- 162
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
yeah,,
do <div onclick="document.getElementById('AcceptCheckbox').checked=true">
Do you accept the terms below?
Blah blah blah
</div>
<input type="checkbox" id="checkbox" />Kreative Development
Infinite Possibilities
-
Jun 21, 2006, 14:07 #4
- Join Date
- May 2006
- Location
- Phoenix, AZ
- Posts
- 162
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
sorry, i didn't read your "no javascript"....to answer ...no
Kreative Development
Infinite Possibilities
-
Jun 21, 2006, 14:49 #5
- Join Date
- Sep 2004
- Location
- Toronto
- Posts
- 795
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Yeah the label is what I was looking for, and the javascript one works fine too. I just hate having to make a listener for such a simple action...
thanks guys...I can't believe I ate the whole thing
Bookmarks