I need to set an element's background color from an attribute. At the current moment I am trying:
$( '[myAttr]' ).css( 'background-color', $( this ).attr( 'myAttr' ) );
but $( this ).attr( 'myAttr' ) is returning undefined.
Is there a way to do this?
thisprobably isn't referring to what you think it is referring to.