Adjacent selector does not work with dynamically added class in IE7 / 8

<span id='span1'>span1</span> <span>span2</span> <button id='btn'>select span1</button> #span1.selected + span { background-color:red; } $('#btn').click(function() { $('#span1').addClass('selected'); }); 

http://jsfiddle.net/xSGh5/

I use an adjacent sibling selector for a style with a custom image, so I don't want to give up on this selector. Any workarounds?

+3
source share
1 answer

Well, this is a known bug, see the section on selector + here: http://www.quirksmode.org/css/contents.html

+4
source

Source: https://habr.com/ru/post/1482369/


All Articles