/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] jquery checkbox.. .show div.. if unchecked hide div.

I’m looking for a bit of help creating this function.

<div name=”main”>

<checkbox></checkbox> If this is checked… display the div below.. if not checked.. don’t display anything.

</div>

<div class=’other’ name=’other’ title=’other’ style=’display:none;’>
<input></input>
<input></input>
<input></input>
</div>

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@cbVisionNov 13.2012 — Here's a simple solution:

http://jsfiddle.net/K8t8B/
Copy linkTweet thisAlerts:
@SupplementauthorNov 13.2012 — Hey cbVision,

That worked out well, the only problem is that there is other checkboxes on the same page and it affects them all, how can i only associate it with the check box i want?
Copy linkTweet thisAlerts:
@SupplementauthorNov 13.2012 — acutally... still need help.. sorry.
Copy linkTweet thisAlerts:
@SupplementauthorNov 13.2012 — [B][U]FIXED!!![/U][/B]


[CODE] <script type="text/javascript">
$(document).ready(function(){
$('#auth_required').change(function(){
var checked = $(this).attr('checked');
if (checked) {
$('.other').show();

} else {
$('.other').hide();
}
});

});&#8203;
</script>
[/CODE]
Copy linkTweet thisAlerts:
@cbVisionNov 13.2012 — Yep! You just target the ID of the checkbox you want. Strong work.
×

Success!

Help @Supplement spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...