Sunday, February 3, 2013
How can u work by class selector?
Now i will teach how can jquery work by class selector...
Syntax:
$(". class name").hide()
Now just copy this code on notepad and see....
<!DOCTYPE html>
<html>
<head>
<script src="jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("button").click(function(){
$(".test").hide();
});
});
</script>
</head>
<body>
<h2 class="test">This is a heading</h2>
<p class="test">This is a paragraph.</p>
<p>This is another paragraph.</p>
<button>Click me</button>
</body>
</html>
<< Previous || Next >>
How can u work by id selector?
Now i will teach how can jquery work by id selector...
Syntax:
$("# id name").hide()
Now just copy this code on notepad and see....
<!DOCTYPE html>
<html>
<head>
<script src="jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("#test").hide();
});
});
</script>
</head>
<body>
<h2>This is a heading</h2>
<p>This is a paragraph.</p>
<p id="test">This is another paragraph.</p>
<button>Click me</button>
</body>
</html>
<< Previous || Next >>
Saturday, February 2, 2013
First programme in jquery
Please first download this file "jquery.min.js".
Now try it just copy and paste it.....Then see how it work
<!DOCTYPE html>
<html>
<head>
<script src="jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("p").hide();
});
});
</script>
</head>
<body>
<h2>This is a heading</h2>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
<button>Click me</button>
</body>
</html>
<< Previous || Next >>
This Tutorial written by Md.Tofazzal Haque
Now try it just copy and paste it.....Then see how it work
<!DOCTYPE html>
<html>
<head>
<script src="jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("p").hide();
});
});
</script>
</head>
<body>
<h2>This is a heading</h2>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
<button>Click me</button>
</body>
</html>
<< Previous || Next >>
This Tutorial written by Md.Tofazzal Haque
How can use event?
All of this you have to use into Document Ready Event
$(document).ready(function(){
// jQuery methods go here...
});
Now i introduced one more event which is used in our event example.
$("button").click(function(){
// jQuery methods go here...
});
<< Previous || Next>>
This Tutorial written by Md.Tofazzal Haque
JQUERY SYNTAX
JQUERY SYNTAX is:
$(selector).action();
you can use it like this:
$(this).hide() -It is used for hides the current element which is select by $(this).
$("p").hide() -It is used to hide all <p> elements.When this function find HTML tag <p></p>,it will hide all element of this tag.
$(".test").hide() -It is used to hide all elements with class="test".
$("#test").hide() -It is used to hide the element with id="test".
<< Previous || Next >>
This Tutorial written by Md.Tofazzal Haque
$(selector).action();
you can use it like this:
$(this).hide() -It is used for hides the current element which is select by $(this).
$("p").hide() -It is used to hide all <p> elements.When this function find HTML tag <p></p>,it will hide all element of this tag.
$(".test").hide() -It is used to hide all elements with class="test".
$("#test").hide() -It is used to hide the element with id="test".
<< Previous || Next >>
This Tutorial written by Md.Tofazzal Haque
Subscribe to:
Posts (Atom)
