javascript - Load content to title from tag -
i wanted load (replace) text <h2>
<h2>text</h2>
to
<title>here!</title>
how can it?
when replacing classes used $(".value").load
... don't know how tags.
thanks
you can set title using document.title
property. setting title content of h2
tag use:
document.title = $('h2').text();
without jquery
var element = document.getelementsbytagname('h2')[0]; if (element.textcontent) { document.title = element.textcontent; } else { document.title = element.innertext; // ie < 9 }
Comments
Post a Comment