header selector in jQuery with example
Header selector returns all the header elements on the page such as h3, h3, h5 etc.
Example :
<html>
<head>
<title>header Selector</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"> </script>
<script type="text/javascript">
$(document).ready(function()
{
$("#myButton").click(function()
{
$(":header").css({'font-size':'20px','background-color':'Orange'});
});
});
</script>
</head>
<body>
<h3>This is h3 element.</h3>
<p>This is paragraph element.</p>
<div>This is div element.</div>
<span>This is span element.</span><br/>
<button id="myButton">Click Me</button>
<button onclick="location.reload()">Reset</button>
</body>
</html>
Demo :
In the above example, we have used header selector. Header selector selects header elements on the page. In the above example, the selector selects the h3 element and applies CSS to it.
0 comments:
Post a Comment