How to change P tag text value in jQuery

亚连
Release: 2018-06-04 17:03:28
Original
2883 people have browsed it

Below I will share with you a jQuery method for changing the text value of the P tag. It has a good reference value and I hope it will be helpful to everyone.

There is a P tag value in the Web front page,

该用户名已被注册

Copy after login

I want to change the content of the P tag through jquery.

I used the val() attribute at the beginning and found that I could not achieve the goal.

val() can be used to change the input content similar to a text box.

After checking, use jQuery HTML operation to complete the operation.

Function Description
$(selector).html(content) Change the (inner) HTML of the selected element
$(selector).append(content) Append content to the (inner) HTML of the selected element
$(selector).prepend(content) "Prepend" content to the (internal) HTML of the selected element
$(selector).after(content) Add HTML after the selected element
$(selector).before(content) Add HTML before the selected element

The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.

Related articles:

How to use the compile operation method in Vue

How to implement the dialog box in Vue

How to implement dynamic progress bar in D3.js

The above is the detailed content of How to change P tag text 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
Popular Recommendations
Popular Tutorials
More>
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!