SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    I Use MODx kenquad's Avatar
    Join Date
    Dec 2009
    Posts
    424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    A good script (preferably jQuery) to gray out a form if a checkbox is ticked

    This seems like a pretty common task, so I feel optimistic that someone has already developed it. However, I'm not sure how to put it into Google so I thought I would ask for recommendations here.

    The situation is a billing/shipping address form, with a checkbox for "billing same as shipping." If the user ticks this checkbox, I want the billing section of the form to "gray out" - or better yet, to pull the values from the shipping section and gray out. This will enhance the user experience by avoiding confusion as to whether or not the billin part of the form still needs to be filled out.

    Any suggestions for a premade solution? If there's a jQuery plugin, that would be gravy.

  2. #2
    SitePoint Evangelist speda1's Avatar
    Join Date
    Jan 2002
    Posts
    550
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'd create a css class that styles the form however you like and add the class dynamically via onclick using jQuery's addClass() function.

  3. #3
    I Use MODx kenquad's Avatar
    Join Date
    Dec 2009
    Posts
    424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That sounds like a plan. Any ideas on the content-mirroring thing? Or can that be done directly with jQuery too?

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,684
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by kenquad View Post
    That sounds like a plan. Any ideas on the content-mirroring thing? Or can that be done directly with jQuery too?
    Here's a tutorial on how to do it.
    Copying Billing and Shipping Address Information with jQuery
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  5. #5
    I Use MODx kenquad's Avatar
    Join Date
    Dec 2009
    Posts
    424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wow - that looks like exactly what I need. Thanks!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •