I am very new in jQuery. I wrote a code
$(document).ready( function() {
a= $( '.play' ).click( function() {
let a = this;
a.css( 'background-image', 'url(pause.svg)' );
return a;
} );
)};
Then when I console a
, I get the correct result also a.css
is referring to jQuery.
but when i clicking on the element a type-error returned.
TypeError: a.css is not a function
Maybe I am not yet properly understand async JavaScript call. My question is, why I am getting this error? How jQuery handle this keyword in to the Array Function?
--- Problem Solved ---
I found this vs $(this) discussion is my answer.