ToolTip with jQuery

Here is the tips for today. ToolTips are as useful as sign boards, aren’t they!

tooltip.PNG

 

<html>
<head>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
  <script src="//code.jquery.com/jquery-1.10.2.js"></script>
  <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
  <script>
	$(function(){
		$(document).tooltip();
	});
  </script>
</head>
<body>

Name: <input type="text" name="myname" id="myname" title="Enter your full name"/>
</body>
</html>

Menu with jQuery

Here is the snippet for today! Lets create a simple menu with jQuery.

menu

 


<html>
<head>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
  <script src="//code.jquery.com/jquery-1.10.2.js"></script>
  <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
  <script>
	$(function(){
		$("#menu").menu();
	});
  </script>
</head>
<body>
<div style="width:250px">
<ul id="menu">
	<li>India
		<ul>
			<li>Tamilnadu</li>
			<li>Andhra</li>
			<li>Maharashtra<li>
		</ul>
	</li>
	<li>Singapore</li>
	<li>Malaysia</li>
</ul>
</div>

</body>
</html>


jquery – starter tutorial #1

To start with jquery is a simpler task. To use jquery is a fun. Here is a starter.

$ refers to jquery

$(this).hide()
Demonstrates the jQuery hide() method, hiding the current HTML element.

$(“#test”).hide()
Demonstrates the jQuery hide() method, hiding the element with id=”test”.

$(“p”).hide()
Demonstrates the jQuery hide() method, hiding all <p> elements.

$(“.test”).hide()
Demonstrates the jQuery hide() method, hiding all elements with.

<html>
<head>
<script type="text/javascript" src="jquery-1.7.2.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  $("p").click(function(){
    $(this).hide();
  });
});

$(document).ready(function(){
  $("#idtest").click(function(){
    $(this).hide();
  });
});

$(document).ready(function(){
  $(".classtest").click(function(){
    $(this).hide();
  });
});

</script>
</head>
<body>
<p>If you click on me, I will disappear.</p>
<p>Click me away!</p>
<p>Click me too!</p>
<div id="idtest">hide this div with id idtest</div>
<span>hide this span with classtest idtest</span>
</body>
</html>