.removeAttr()


.removeAttr( attributeName )Возвращает: jQuery

Описание: Метод для удаления атрибутов (таких как id, class, title и.т.д) у элементов страницы.

  • Добавлен в версии: 1.0.removeAttr( attributeName )

    • attributeName
      Тип: String
      An attribute to remove; as of version 1.7, it can be a space-separated list of attributes.

The .removeAttr() method uses the JavaScript removeAttribute() function, but it has the advantage of being able to be called directly on a jQuery object and it accounts for different attribute naming across browsers.

Note: Removing an inline onclick event handler using .removeAttr() doesn't achieve the desired effect in Internet Explorer 8, 9 and 11. To avoid potential problems, use .prop() instead:

1
2
$element.prop( "onclick", null );
console.log( "onclick property: ", $element[ 0 ].onclick );

Примеры использования