?
Solved

show/hide DIV based on checkbox click

Posted on 2010-11-10
3
Medium Priority
?
640 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 2

Author Comment

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

Accepted Solution

by:
Insoftservice earned 1000 total points
ID: 34103891
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
ID: 34105109
Thank you, the idea worked. I didn't realize that I can use a combo of javascript and jquery.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This month, Experts Exchange’s free Course of the Month is focused on CompTIA IT Fundamentals.
IF you are either unfamiliar with rootkits, or want to know more about them, read on ....
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses
Course of the Month8 days, 11 hours left to enroll

764 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