Lets say I have this code:
<div class="user">
<img class="profilepic" src="someimage.jps">
<div class="cleaner"></div>
[ <a href="javascript:void(0);" id="skip" Onclick="javascript:chg_background();">change bg</a> ]
<div class="cleaner" style="padding-bottom: 5px;"></div>
</div>
How can i change div class=”user” with red background, with jquery parent method or similar?
Thanks!
Guns
You could use
closestto walk back up the DOM tree:And change the HTML to this:
Or do it in a more traditional jQuery fashion:
And drop the
onclickattribute on the#idlink.