Home > Web Front-end > JS Tutorial > What does prop mean in jquery

What does prop mean in jquery

little bottle
Release: 2019-05-31 16:19:45
Original
5764 people have browsed it

jQuery is a cross-browser JavaScript library that simplifies operations between HTML and JavaScript. There are many methods in this library. Below I will take you to understand the prop() method.

What does prop mean in jquery

The prop() method is used to set or return the attributes and values ​​of the selected element.

When this method is used to return an attribute value, the value of the first matching element is returned.

When this method is used to set attribute values, one or more attribute/value pairs are set for the set of matching elements.

jquery basic learning tutorial

Syntax

Return the value of the attribute:

$(selector).prop(property)
Copy after login

Set properties and values:

$(selector).prop(property,value)
Copy after login

Set properties and values ​​using functions:

$(selector).prop(property,function(index,currentvalue))
Copy after login

Set multiple properties and values:

$(selector).prop({property:value, property:value,...})
Copy after login

The above is the detailed content of What does prop mean 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 Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template