Matrixkid Posted October 21, 2009 Share Posted October 21, 2009 Hey, I was wondering if someone could push me in the right direction with an issue im having, actually two. First of all, im trying to change the background of the 1st parent div that contains a string. Heres what im using: $("div:contains(' minutes ago')").css("background", "rgb(229, 128, 108)"); Basically what is happening is that this is highlighting the parent, of the parent, of the parent divs. Where as I just want the first element highlighted. I was wondering how this could do be done? Secondly, I want to run this once my page has loaded - I have several elements that depend on a json response, and therefore when I run this jquery statement it does nothing, yet, if i run it in the javascript console in chrome or firebug, it works - since the divs are filled with information. How do I go about running the statement once the divs are filled with text from the json response? Thanks MK Quote Link to comment Share on other sites More sharing options...
Matrixkid Posted October 21, 2009 Author Share Posted October 21, 2009 Got it all. I just ran the following once the json reponse filled the div (after the $().html statement) var $lists = $('.rss-elem').find("div:contains(' minutes ago')"); $lists.parent().css("background","#E5806C"); Cheers Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.