Jquery for getting values of h2 tags

HTML Code

<div id="pageSpecificBanners"><h2 class="page-Title">about us</h2></div>

//banner + page title for the Practices page..
<div id="pageSpecificBanners"><h2 class="page-Title">practices</h2></div>
Jquery
var value = $("#pageSpecificBanners h2").html();

if(value == "about me")
    $('div#PageSpecificBanners')
        .append('<h2 class="printOnlyPage-Title">about us</h2>');
else if(h2 == "practices")
    $('div#PageSpecificBanners')
        .append('<h2 class="printOnlyPage-Title2">practices');

Comments

Popular posts from this blog

What is HTML? Complete Beginner’s Guide (with Examples)

HTML Forms — Input, Label, Button & Validation (Explained Like a Teacher With Examples)

Difference Between HTML and HTML5 (2025 Explained) | Features, Advantages & Comparison Table