javascript - Changing a "target=_" in a hardcoded href link -
we have wordpress site uses 3dcart widget - dynamically populates products section of page. see page example
http://www.slipcovermall.com/chairs/wing-chair/
the issue is, plugin hardcodes "target="_new" in each product link, when click on "add cart" taken new browser window. there javascript way in page header change target called self, or remove target= altogether?
using jquery (which included on page, assume it's ok):
jquery(document).ready(function() { jquery("a[target='_new']").removeattr("target"); });
if jquery not available, use
document.queryselectorall("a[_target='new']")
iterate on elements , invoke removeattribute("target")
:
var links = document.queryselectorall("a[target='_new']"); for(var = 0; < links.length; i++) { links[i].removeattribute("target"); }
Comments
Post a Comment