Solved

show/hide DIV based on checkbox click

Posted on 2010-11-10
3
624 Views
Last Modified: 2012-05-10
I have a checkbox in my form. If the checkbox is checked, I need to show a div tag. If it is unchecked, I need to hide the div tag.

Please help.

0
Comment
Question by:sshivanna
  • 2
3 Comments
 
LVL 2

Author Comment

by:sshivanna
Comment Utility
sorry, I need to accomplish this using Jqeury.
Thank you
0
 
LVL 15

Accepted Solution

by:
Insoftservice earned 250 total points
Comment Utility
Hi,
I hope u have only one chk box.

<input type="checkbox" name="foo" value="bar" />

var value =  $('input[name=foo]').is(':checked') // to check whether its true or false 1st method
var value = $('input[name=foo]').attr('checked') // to check whether its true or false 2nd method
if(value ==true){
$('#divid').show();
}
else{
$('#divid').show();
}
0
 
LVL 2

Author Comment

by:sshivanna
Comment Utility
Thank you, the idea worked. I didn't realize that I can use a combo of javascript and jquery.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Marketing can be an uncomfortable undertaking, especially if your material is technology based. Luckily, we’ve compiled some simple and (relatively) painless tips to put an end to your trepidation and start your path to success.
Scam emails are a huge burden for many businesses. Spotting one is not always easy. Follow our tips to identify if an email you receive is a scam.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now