javascript - How to add hyperlink in the min.js function -


function(){i.image&&(s.cover.classlist.add(o+"-cover"),s.cover.style.width=i.imagewidth+"px",   s.cover.style.backgroundimage="url("+i.image+")",  s.cover.style.height=i.imagewidth+"px",   i.rtl?s.toastbody.style.marginright=i.imagewidth+10+"px":s.toastbody.style.marginleft=i.imagewidth+10+"px",s.toast.appendchild(s.cover))}(), 

the outcome javascript above below:

<div class="izitoast-cover" style="width: 70px; background-image:url”../img/123.jpg”);"></div> 

i add onclick function on become:

<div class="izitoast-cover" **onclick="location.href='newurl.html';"** style="width: 70px; background-image: url”../img/123.jpg”);"></div> 

i have try s.cover.onclick.location.href='newurl.html', not working.

can tell me should add on js code?

so add event listener

s.cover.addeventlistener("click", function () {    window.location.href = "http://www.example.com"; }); 

Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -