Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How js modifies the title title of html

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 237

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report