Filtering h2 from h1,h3,h4..........(all headers)
Hi,
I am new to web development (3 months).
I am learning JQuery now.
I am writing a small html code which has h1, h2, h3 and h4 header elements. There is a button as well.
Once the button is clicked I want to have red color background to h1, h3 and h4. I need to filter out h2.
This is the code I wrote, but not working though.
Please help me.
<script>
$(document).ready(function(){
$("button").click(function(){
$(":header").filter($("#h3")).css( 'background-color' , 'red');
});
});
</script>
<body>
<h1>header 1</h1>
<h2>header 2</h2>
<h3>header 3</h3>
<h4>header 4</h4>
<button>Click me</button>
</body>
Thanks in advance.
Isaac