Get the App
SLTechnology News&Howtos  ›  Development  › 

How js modifies the title title of html

Shulou Source: shulou.com Published: 2022-06-03 19:09:08 09月11日 Update

This article mainly introduces how js modifies the title title of html. It is very detailed and has a certain reference value. Interested friends must read it!

Js modify html title method: 1, use "document.title=" need to set the value ";" statement; 2, use "$('title'). Html (' new value')" or "$('title'). Text (' new value')" statement.

The operating environment of this tutorial: windows7 system, javascript1.8.5&&jquery1.7.2 version, Dell G3 computer.

Methods 1:document.title mode

After testing, you can also set the value of title through document.title.

Document.title = 'value to be set'

Examples

Hello document.title =''

Method 2: use the html () or text () method of jQuery

Of course, if your project relies on jQuery, you can use the jq method to set it.

Both methods can be implemented in jq.

$('title') .html (' value to be set') $('title') .text (' value to be set')

Examples

Hello / / $('title'). Html (''); $('title'). Text (''); the above is all the content of the article "how js modifies the title title of html". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Methods sentences titles examples content methods articles values interests guys partners tutorials more environment computers knowledge systems industry information information channels Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia macOS Microsoft Shulou Information Apple