Solved

show/hide DIV based on checkbox click

Posted on 2010-11-10
3
627 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
ID: 34103810
sorry, I need to accomplish this using Jqeury.
Thank you
0
 
LVL 15

Accepted Solution

by:
Insoftservice earned 250 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

One of the biggest threats in the cyber realm pertains to advanced persistent threats (APTs). This paper is a compare and contrast of Russian and Chinese APT's.
Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

785 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