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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.