This:
$(obj).parent.addClass("newstyle");

should be like:
$(obj).parent().addClass("newstyle");

On Aug 11, 1:08 pm, Russ <[email protected]> wrote:
> Hello,
>
> I have a link;
> <a href="javascript:{}" onclick="DoSomething(this)">click me</a>
>
> And what i'd like to do is use the "this" object to manipulate the css
> of its parent;
>
> function DoSomething(obj) {
>
>     if(obj) {
>         $(obj).parent.addClass("newstyle");
>
>         //i can do this with javascript, but i dont want to write
> styles into my js
>         //obj.parentNode.style.backgroundColor = '#FFFFEE';
>     }
>
> }
>
> Does anyone know how to do this with jquery?

Reply via email to