Home>Article>Web Front-end> How to modify the content of a in jquery

How to modify the content of a in jquery

藏色散人
藏色散人 Original
2021-12-01 11:53:33 2681browse

How jquery modifies the content of a: 1. Set the attribute value of the selected element through the jquery attr() method; 2. Set the text content of the selected element through the jquery text() method.

How to modify the content of a in jquery

The operating environment of this article: windows7 system, jquery3.2.1 version, DELL G3 computer

How to modify the content of a with jquery?

jquery modifies the href link and text of a tag

The following is the code to modify the href link and text of a tag:

Original link:

柯乐义

Modify the href link of the a tag:

$('#home_keleyi_com').attr('href','http://keleyi.com');

Modify the text:

$("#home_keleyi_com").text('柯乐义首页');

The modified link is:

柯乐义首页

The following is the complete link Code:

   jquery修改链接--柯乐义  

jquery to modify the href link and text of the a tag, first click the link below df250b2156c434f3390392d09b1c9563 then click the "Change" button, then click the link below once, pay attention to opening the page twice Different:


原文

Recommended learning: "jquery video tutorial"

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

Statement:
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
Previous article:Does jquery have alert? Next article:Does jquery have alert?