Modify Style - Operating Method css

    1. Parameter write-only attribute name, attribute value is returned

      $(this).css( ' color ');   //300px

    2. The parameter is a property name, property values, separated by commas, is set up a set of styles, attributes must be quoted, if the value is a number you can not with the unit and quotes

      $ (This) .css ( "color", "red"); // set the current element font color is red

    3. The parameters may be in the form of the object, the sets of style easy setup, attribute names and values ​​are separated by a colon, the properties may not be quoted, if the composite name attribute must hump method:

      $(this).css({

        color : " red ",

        width : "300px",

        backgroundColor: "pink" // using named composite hump property law

      })

Guess you like

Origin www.cnblogs.com/qtbb/p/11332681.html