jquery - Change the onclick attribute -


<div class="hp_imp" onclick="location.href='https://www.abc.com/xyz';">         </div>  <div class="hp_imp" onclick="location.href='https://www.abc.com/xyz/';"> </div> 

the first div div https://www.abc.com/xyz , need make url https://www.abc.com/xyz/ in div dynamically.

$('.hp_imp').attr('onclick', function(i, val) { return val + '/'; }); 

don't care inline event handlers, , should consider removing it, change it, should work.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -