+ 5
Difference between both method ? Is 2nd method is not the correct way to use? btw both working fine
//Getting current src value of img using event object var imgSrc = e.target.getAttribute('src'); //Getting current src value of img using event object without getAttribute var imgSrc = e.target.src;
1 Resposta
+ 3
Better use direct method, more readable and faster response. And old IE8 might not support get/setAttribute.