WebArtz - The Web Design Forum
Welcome to WebArtz, Guest!

WebArtz is a nice place for discussions related to web designing and coding. We help our members to code their own website templates with HTML and CSS. We give them advice on various issues.

To know more about WebArtz Forum, visit the About Us page.

At the moment, you are viewing the forum as a guest. As a guest you can't make post and participate in discussions. You need to register and become a member of the forum. Click the register link below and become a part of this forum.

Thank You


You are not connected. Please login or register

View previous topic View next topic Go down  Message [Page 1 of 1]

1 HTML and JavaScript Help needed! on Tue Jul 06, 2010 5:19 am

Guest


Guest
Hey guys,

I'm looking for the code to make the following. I want to have two option radio buttons. One named "Yes" and the other one named "No".

When you click the "Yes" button, a certain function happens. However, if you click the "No" one, nothing will happen.

Example,

Show content?
Yes is checked

<--Content is here-->

No is checked

No content or anything

Get what I mean? Would really want this asap please. Thanks!

2 Re: HTML and JavaScript Help needed! on Tue Jul 06, 2010 2:26 pm

ankillien

avatar
Administrator
Administrator
Hi!

I think this code would do that...

Code:
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>for loop</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
<!--
$(document).ready(function(){
$('input[value=yes]').click(function() {
$('#showhide').css("visibility","visible"); })
$('input[value=no]').click(function() {
$('#showhide').css("visibility","hidden"); }) });
-->
</script>
</head>

<body>

<form>
  YES <input type="radio" name="lol" value="yes" /><br />
  NO <input type="radio" name="lol" value="no" />
</form>

<div id="showhide" style="visibility:hidden;">Trigger the handler</div>

</body>
</html>

3 Re: HTML and JavaScript Help needed! on Wed Jul 07, 2010 1:05 am

Guest


Guest
Thanks, anki!

4 Re: HTML and JavaScript Help needed! on Wed Jul 07, 2010 9:04 am

ankillien

avatar
Administrator
Administrator
Glad I could help Very Happy

Solved | Locked

Sponsored content


View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum