How to reset header on HTML page without reloading?

I am trying to reset the page title in jQuery without updating it. Each place that I looked at allows me to use:

$('title').text('foo');

OR

$(document).attr('title', 'foo2');

Which [apparently] needs to be updated to work properly. I load the information into a div on the main page and do not need to refresh the page. Does anyone have any ideas? Thanks in advance!

+4
source share
3 answers

Not so much for jquery, except in cases (i.e., processing an event), you decided to change the name of the page: document.title = 'something';

+13
source

You cannot use document.title = "Something new"; ?

+4
source

yes I agree with @sidyll. Apparently, 80% of jQuery users are no longer JavaScript, so they sometimes try to use javascript concepts.

but you can do with jquery like:

 <script type="text/javascript"> $(function(){ $('#changeTitle').click(function(){ $('title').html('New title'); }); }); </script> 
+1
source

All Articles