How to modify title value in jquery

青灯夜游
Release: 2022-04-28 16:55:31
Original
4836 people have browsed it

How to modify the title value in jquery: 1. Use text() to modify the title tag value, the syntax is "$("title").text("new value");"; 2. Use attr( ), you can modify the title attribute value, the syntax is "element.attr("title","new value");".

How to modify title value in jquery

The operating environment of this tutorial: windows7 system, jquery1.10.2 version, Dell G3 computer.

In HTML, there are two types of title values:

  • The content value of the title tag

  • The attribute value of the title attribute

So how to use jquery to modify these two title values? Let me introduce to you

1. jquery to modify the title tag value## The

# tag defines the title of the document and is required in all HTML documents.

Element:

  • Defines the title in the browser toolbar

  • Provided that the page is The title when added to favorites

  • The page title displayed in the search engine results

You can use # to modify the title tag value ##text()

Method. The text() method returns the text content of the selected element.Example:

    文档的旧标题   
Copy after login

2. jquery modifies the title attribute value

The title attribute specifies additional information about the element.

This information usually displays a tooltip text when the mouse is moved over the element.

To modify the value of the title attribute, you can use the

attr()

method, which can set the value of the specified attribute of the selected element.

      
这是一个测试文本


Copy after login

How to modify title value in jquery[Recommended learning:

jQuery video tutorial

,web front-end video

The above is the detailed content of How to modify title value in jquery. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!