Tom Knowlton
asked on
jquery getting overwritten by CSS?
I think my jQuery CSS changes are getting overwritten by the THEME css for the page that gets applied.
How can I correct this?
I either want to run the jquery AFTER the css gets applied
or
set up a trigger event on the css getting changed. If the class changes to this then do something.
$('span[id*="TopCart2_lblT otalItems" ]').css("c olor", "#532B8F");
$('span[id*="TopCart2_Labe l1"]').css ("color", "#532B8F");
$('span[id*="TopCart2_lblT otalAmount "]').css(" color", "#532B8F");
In essence, if the color changes to anything OTHER THAN #532B8F then I want to change the color BACK to #532B8F
How can I correct this?
I either want to run the jquery AFTER the css gets applied
or
set up a trigger event on the css getting changed. If the class changes to this then do something.
$('span[id*="TopCart2_lblT
$('span[id*="TopCart2_Labe
$('span[id*="TopCart2_lblT
In essence, if the color changes to anything OTHER THAN #532B8F then I want to change the color BACK to #532B8F
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Are your waiting the total loading of the page with the following for example :
$(document).ready(function () {
alert( $('span[id*="TopCart2_lblT otalItems" ]').length ); // should be greater than zero
alert( $('span[id*="TopCart2_Labe l1"]') ); // should be greater than zero
alert( $('span[id*="TopCart2_lblT otalAmount "]') ); // should be greater than zero
$('span[id*="TopCart2_lblT otalItems" ]').css("c olor", "#532B8F");
$('span[id*="TopCart2_Labe l1"]').css ("color", "#532B8F");
$('span[id*="TopCart2_lblT otalAmount "]').css(" color", "#532B8F");
})
$(document).ready(function
alert( $('span[id*="TopCart2_lblT
alert( $('span[id*="TopCart2_Labe
alert( $('span[id*="TopCart2_lblT
$('span[id*="TopCart2_lblT
$('span[id*="TopCart2_Labe
$('span[id*="TopCart2_lblT
})
ASKER
>>>>Are your waiting the total loading of the page with the following for example :
$(document).ready(function () {
-------------------------- ---------- ---------- ----
Yes
$(document).ready(function
--------------------------
Yes
Ok, so double check the ID of the SPAN
If you can use Control.ClientID : http://msdn.microsoft.com/en-us/library/system.web.ui.control.clientid.aspx
http://dotnetslackers.com/ASP_NET/re-113573_The_difference_between_ID_ClientID_and_UniqueID.aspx
$('span[id*="TopCart2_lblT otalItems" ]')
mean something like : <span id="smlfksmfsflksflmsfmskTopCart2_lblTotalItemsfksflfmkfmskj">
If you can use Control.ClientID : http://msdn.microsoft.com/en-us/library/system.web.ui.control.clientid.aspx
http://dotnetslackers.com/ASP_NET/re-113573_The_difference_between_ID_ClientID_and_UniqueID.aspx
$('span[id*="TopCart2_lblT
mean something like : <span id="smlfksmfsflksflmsfmskTopCart2_lblTotalItemsfksflfmkfmskj">
ASKER
ASKER
At about time index :48 I click on the "Add to Cart" button and the cart styling goes all crappy.
ASKER
If I refresh the page AFTER the styling goes away....the styling gets applied again.
It's something with the button click.
It's something with the button click.
with << code behind >>
ASKER
Now I can't get it to do it anymore....
:::: frustrating :::::
I guess it was a temporary glitchy thing....oh well.
Thanks for the time and effort...if it happens again I'll come back to try a few of the other suggestions...
:::: frustrating :::::
I guess it was a temporary glitchy thing....oh well.
Thanks for the time and effort...if it happens again I'll come back to try a few of the other suggestions...
ASKER
thx
ASKER