Disallows the .attr
/.removeAttr
methods and $.attr
/$.removeAttr
utilies. Prefer Element#getAttribute
/setAttribute
/removeAttribute
.
📋 This rule is enabled in plugin:no-jquery/all
.
❌ Examples of incorrect code:
$.attr();
$( 'div' ).attr();
$div.attr();
$( 'div' ).first().attr();
$( 'div' ).append( $( 'input' ).attr() );
$( 'div' ).attr( 'name' );
$( 'div' ).attr( 'name', 'random' );
$.removeAttr();
$( 'div' ).removeAttr( 'name' );
✔️ Examples of correct code:
attr();
[].attr();
div.attr();
div.attr;
removeAttr();
div.removeAttr;