开发者

Alternative to jQuery .siblings()? .siblings is returning a set including current selected element

开发者 https://www.devze.com 2023-02-03 17:49 出处:网络
I have four div\'s which were cloned from another 4 div\'s. The cloned div\'s have new id\'s. When one of the new div\'s is selected and I do $(this).siblings(), I am getting back the 4 new div\'s ins

I have four div's which were cloned from another 4 div's. The cloned div's have new id's. When one of the new div's is selected and I do $(this).siblings(), I am getting back the 4 new div's instead of 3. I am not sure why this is happening and if cloning messed something up.

Is there a way to make siblings work right in my case? Is there a way to select the other 3 div's without using siblings(开发者_C百科)?


Thanks to Rocket for giving me the idea for not(). However not(this) didn't work.

I had to $(this).siblings().not('#' + $(this).attr("id"));

0

精彩评论

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