Javascript/jQuery working perfectly in Chrome but not in Firefox -
i've been using code allows people pay paypal express checkout when using our site in gbp currency, don't want option there when using euro's, dollars, or other currency.
in custom css i've used
.paypalbutton {display: none !important;} then in javascript/jquery i've used
window.setinterval(function(){ if (jquery(".currency-selector:contains('gbp')").length) { jquery(".paypalbutton").attr('style', 'display: inline-block !important'); } 1000}); the reason i've done way because paypal button loaded in dynamically php. , reason .on , .live don't seem work.
now works in google chrome, i've been testing in. reason wont work in firefox (haven't tested other browsers yet). question is, why wont work in firefox?
thanks help.
some more info:
the code doesn't seem having problems in firefox when typed console, paypal button should showing when on 'gbp' not showing in firefox in chrome.
chrome has:
.paypalbutton {display: inline-block !important} <strike>.paypalbutton {display: none !important}</strike> firefox has:
.paypalbutton {display: none !important} <strike>.paypalbutton {display: inline-block !important}</strike>
you have error defining setinterval function
try below :
window.setinterval(function(){ if(jquery(".currency-selector:contains('gbp')").length){ jquery(".paypalbutton").attr('style', 'display: inline-block !important'); /*jquery(".paypalbutton").css({ 'display' : 'inline-block !important' });*/ } },1000); note :
consoleoutput both browsers. check if therescript error. check if javascriptdisabled/not supportedbrowser.
here setinterval function syntax
window.setinterval(mycallbackfunction, durationinmilliseconds); example :
var intervalid = window.setinterval(mycallback, 500); function mycallback() { // code here } more details setinterval() function. , jquery browser support
Comments
Post a Comment