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

What does prop mean in jquery

little bottle
little bottleOriginal
2019-05-31 16:19:455576browse

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)

Set properties and values:

$(selector).prop(property,value)

Set properties and values ​​using functions:

$(selector).prop(property,function(index,currentvalue))

Set multiple properties and values:

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

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!

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