zoukankan      html  css  js  c++  java
  • jQuery .prop()

    .prop()

    .prop( propertyName )Returns: Anything

    Description: Get the value of a property for the first element in the set of matched elements.

    The .prop() method gets the property value for only the first element in the matched set. It returns undefined for the value of a property that has not been set, or if the matched set has no elements. To get the value for each element individually, use a looping construct such as jQuery's .each() or .map() method.

    Note: Attempting to change the type property (or attribute) of an input element created via HTML or already in an HTML document will result in an error being thrown by Internet Explorer 6, 7, or 8.

    Attributes vs. Properties

    The difference between attributes and properties can be important in specific situations.

    Before jQuery 1.6, the .attr() method sometimes took property values into account when retrieving some attributes, which could cause inconsistent behavior.

    As of jQuery 1.6, the .prop() method provides a way to explicitly retrieve property values, while .attr() retrieves attributes.

  • 相关阅读:
    5.21php
    5.20日报
    kubernetes
    kubernetes
    Kubernetes
    Docker
    Docker
    Docker
    Docker
    Docker
  • 原文地址:https://www.cnblogs.com/chucklu/p/11164056.html
Copyright © 2011-2022 走看看