JQuery addClass to all Elements with Class?

Your HTML is wrong You probably meant to set class instead of id. Your current code will work if you fix your HTML. You might want to see this answer, it explains why a script doesn't work when included before the DOM elements.

I have fixed it it still only does it on the first 'specialprice' that appears. – ToddN May 2 at 18:09 @ToddN where does this script runs? $(document).

Ready? It have to execute at least after all DOM nodes render. Put your script after all those elements.

– BrunoLM May 2 at 18:10 BINGO! You got it, it was not placed correclty in the document.ready. My current code does indeed work correctly, thank you!

– ToddN May 2 at 18:15.

$('. Priceis'). Each(function(i, item) { var $item = $(item); if( $item.

HasClass('specialprice') || $item. Parents('. Specialprice') ) { $item.

AddClass('strike'); } }).

This did not work – ToddN May 2 at 18:11.

This added class 'strike' with 'specialprice' not just the 'priceis' – ToddN May 2 at 18:10 @ToddN, im not sure what you mean – Neal May 2 at 18:11.

Still not sure about the explanation of your question, not clear.. $(function() { $('. Specialprice'). Each(function() { $(this).

Find('. Priceis'). AddClass('strike'); }); } EDIT: just realized maybe you wanted it like this?

$('. Specialprice'). Each(function() { $(this).

Find('*'). AddClass('strike'); }).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions