1.

How Can Jquery Library Be Added To Pages? Write A Basic Jquery Code?

Answer»

The JQUERY library is a COLLECTION of all the jquery methods. It is stored in the form of a single java script FILE. The format of adding a jquery file to an html PAGE is:

<head>
<script type=”text/javascript” src”jquery.js”></script>
</head>

An example of a javascript that will hide all the <p> elements in the page.

<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(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>

The jquery library is a collection of all the jquery methods. It is stored in the form of a single java script file. The format of adding a jquery file to an html page is:

<head>
<script type=”text/javascript” src”jquery.js”></script>
</head>

An example of a javascript that will hide all the <p> elements in the page.

<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(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>



Discussion

No Comment Found