3 Replies - 578 Views - Last Post: 02 April 2015 - 02:40 AM

#1 chiChi94   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 26-January 15

jQuery not working

Posted 01 April 2015 - 07:33 PM

$(document).ready(function(){
        $('#b1').click(function(){
		var value = $("#b1").attr('value');
		$('#p1').toggle();
		
		if (value == 'Show'){
		$('#b1').attr('value', 'Hide');
  }
  else if(value == 'Hide'){
  $('#b1').attr('value', 'Show');
  }
  });
});



<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>WWW Conference</title>
<link href="css/bootstrap.css" rel="stylesheet" type="text/css">
<link href="css/styles.css" rel="stylesheet" type="text/css">
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js?ver=1.4.2'></script>
<script src="jqueryMy.js" type="text/javascript"></script>
</head>
<body>


<div class="col-lg-12"><h1>World Wide Web Conference 2015</h1><hr>
<nav class="navbar navbar-default navbar-collapse"><ul class="nav navbar-nav"><li role="presentation" class="active"><a href="index.html">Home</a></li><li> <a href="sessions.html">Sessions</a></li><li> <a href="Registration.html">Registration</a></li></ul></nav>
<h2>Plan to Attend - Register Now!</h2>


<div class="col-md-5 alert alert-danger" id = "p1">
	<h3>Share Your Ideas</h3>
	<p >The World Wide Web Conference is an annual conference sponsored by McGill University and the Institut de Technologie de Montreal.  This year the converence is being held on October 15-16, 2015 at the Palais des congres in Montreal.
	<br>
	Conference Session are lecture, panel discussion, or workshop format.  All sessions are 75 minutes - 60 minutes for presentation and 15 minutes for questions.</p>

	
	 
</div>


<div class="col-md-5 col-md-offset-1 alert alert-danger">
	<h3>Network with Colleagues</h3>
	<p>We encourage you to submit a proposal via email.  Download the form and email it to [email protected]  The proposal deadline is June 10, 2015.
	<br>
	Experience professionals are invited to submit proposals for conference sessions.  The conference committee accepts proposals based on topic and information quality.  We encourage session on advanced topics, especially innovation Web technology.</p>
	
	 
</div>


</div>
<div style = "text-align:center;">
	<button type="button" class="btn btn-default" id="b1" >Show</button>
		<button type="button" class="btn btn-default" id="b2" >Hide</button>
</div>

</body>
</html>


When i click my buttons its not working. Can't figure out what's wrong. give me hand here please

Is This A Good Question/Topic? 0
  • +

Replies To: jQuery not working

#2 e_i_pi   User is offline

  • = -1
  • member icon

Reputation: 879
  • View blog
  • Posts: 1,893
  • Joined: 30-January 09

Re: jQuery not working

Posted 01 April 2015 - 07:44 PM

What do you expect lines 3, 7 and 10 of your jQuery to do?
Was This Post Helpful? 0
  • +
  • -

#3 chiChi94   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 26-January 15

Re: jQuery not working

Posted 01 April 2015 - 08:23 PM

They must also be disabled and/or changed in some way when their functionality is not appropriate. For example, if the content is currently visible, then the “Show” button should not be accessible.
Was This Post Helpful? 0
  • +
  • -

#4 JackOfAllTrades   User is offline

  • Saucy!
  • member icon

Reputation: 6259
  • View blog
  • Posts: 24,028
  • Joined: 23-August 08

Re: jQuery not working

Posted 02 April 2015 - 02:40 AM

Moved to jQuery.

Your buttons have no attribute named value.

Quote

For example, if the content is currently visible, then the “Show” button should not be accessible.


I would use this to determine if it's visible: if ($('#p1').is(':visible'))
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1