Search code examples
javascriptjquerytitle

Changing document title is not working


I'm trying to add the notification number to the title in a function, but it won't work. This is my code:

  var docTitle = document.title;

  document.title = "".docTitle." (".$(".loadnot").html().")";

Solution

  • In JavaScript you should use + for concatenating not ..

    document.title = docTitle + "(" + $(".loadnot").html() + ")";