Attribute selectors, JavaScript and IE8

前端 未结 5 1339
滥情空心
滥情空心 2021-01-18 21:09

I\'m attempting to use attribute selectors and CSS for formatting elements.

The HTML looks like:

User Name
5条回答
  •  不思量自难忘°
    2021-01-18 21:34

    You are setting the attribute to JavaScript true and false, not string "true" and "false". This could be interpreted by the browser as 1 and 0 and lead to unwanted results.

    Can you try

    node.setAttribute('highlight', 'true');
    

    ?

提交回复
热议问题