开发者

Opera error in html5 : data-xxxx custom tag issue rewriting

开发者 https://www.devze.com 2023-01-19 05:07 出处:网络
i come now cause Opera is giving me more job than what a think , the problem is the next: $(\'.colourbox\').click( function()

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');
    $(thi开发者_如何学Gos).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 doesn't change.


$('.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.


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?

0

精彩评论

暂无评论...
验证码 换一张
取 消