Jump to content

[SOLVED] adjacent text clickable to checkoff checkbox?


boo_lolly

Recommended Posts

i've seen this user-friendly functionality in a lot of sites. there is a checkbox in a form and some text next to it explaining what the checkbox is for. you can click the adjacent text (which is much easier to target) and it checks, or unchecks the checkbox. i googled it and found this link

http://www.askdavetaylor.com/make_text_adjacent_to_checkbox_clickable.html

 

it provided this code:

<form name="f1">
Modifications to your coffee order:<br >
  <input type="checkbox" name="cb1">
<span onClick="document.f1.cb1.checked=(! document.f1.cb1.checked);">
Add whipped cream to your drink (add $0.50)</span>
</form>

 

and mine lookes like this:

<form name="f1">
<input type="checkbox" name="mailinglist">
<span onClick="document.f1.mailinglist.checked=(! document.f1.mailinglist.checked);">
Join our mailing list to receive updates and last-minute specials and more!
</span>
</form>

 

it doesn't work. is there a newer method of doing this? i'm not sure what the problem is here. it looks like everything makes sense. any help?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.