views:

32

answers:

2

Hi again , i come now cause Opera is giving me more job than what a think , the problem is the next :

$('.colourbox').click( function()
{
    $('.colourbox').css('border-color','#a3a3a3');
    $('.colourbox').attr('data-selected','no');
    $('.colourbox').children().css('border-color','transparent');
    $(this).css('border-color','#222');
    $(this).children().css('border-color','#fff');
    $(this).attr('data-selected','yes');
    }

I have this code , and the problem is the next , when i do it first time , $(this).attr('data-selected','yes'); create the tag and the value , but when i try to rewrite in a second click width $('.colourbox').attr('data-selected','no'); , the data doesnt change.

thank you in advance :D

A: 

It seems to be working fine for me, if you query the attribute value before and after the change it always reports what I would expect. How are you determining it's not working? Is it just that Dragonfly is not updating to reflect changes in the DOM?

robertc
I was determininng it , cause the result comes in another part Graphically. But i have put that little part, cause i was sure the problem was there. Seeing this $('.colourbox').attr('data-selected','no'); after that the result , wasnt no at all .colourbox . Maybe can it be a problem of the selector . and data-new custom attributes . I dont know , but i have done it width .data() jquery function. Thx anyway. I think it can be the meder answer , but im not sure , illput him the right then cause is near to the real answer.
Angelus
A: 

$('.colourbox').attr('data-selected','no');

^ This selects every element so it may be returning all or the last value of the entire set. Try querying one at a time, eg .eg(0) to ensure and then refactor based on this.

meder
Im not sure this is the answer , but i have done it like tando says in the comment . All about the problem is answered in robertc answer comments.
Angelus