html - Adding CSS via Javascript -
i trying add css styling (in addition styles in place) via javascript (simply because not have access main css file)
html:
<a class='store-locator-button'>replace me</a>
javascript:
$(function() { $('.store-locator-button').addclass('tempstorebutton'); $("a.store-locator-button").each(function(index,el){ $(el).text('buscar una tienda'); }); });
css:
.tempstorebutton{padding:5px; color:#fa5dae;}
it works fine in jsfiddle, not on site. suggestions?
the order in css applied important. should add javascript code @ bottom of page make sure gets applied in case other styles applied before hand. try !important property in case css overriden.
Comments
Post a Comment