Skip to content Skip to sidebar Skip to footer

Transform Class Text To My Domain Name Without Http And Www

Using jquery or any script, how to change Text inside semantic

and

with class='site-title' on my
to my domain name without http://, www. and pe

Solution 1:

Try this :

$(document).ready(function () {
    $('.site-title').text(window.location.host);
});

Where the text of h1 and p will be replaced by the current url of the page.

JSFiddle

Solution 2:

you can do something like that with jquery:

var myDomain = window.location.host;
    $(".site-title").html(myDomain);

Solution 3:

Try this code:

var site = location.hostname.replace(/^www\./,'');
$('.site-title').text( site );

Post a Comment for "Transform Class Text To My Domain Name Without Http And Www"