jquery - Display default icon, and replace icon if class is set on div -


I want to create a div tag with an icon on the left, and some text.

Now, if there is an incident, by using jquery I am adding a square to this div tag so that the icon is replaced with another icon.

I have jquery side of things, but I'm not sure how to do this through CSS.

My CSS:

  & lt; Div id = "tag-user" class = "usertag select" & gt; Some tags are & lt; / Div & gt; .usertag {background: url ("/ images / tags") no-repeat;}. Set. Selected (background: url ("/ images / tag-selected"); no-repeat;}  < / Pre> 

The image is not showing, so I think my CSS is incorrect.

< P> You have a space between your class name, it should be

  .usertag.selected  

the same element as the selected On .usertag.

.sertag matches the elements with the selected elements An R .usertag.

Be aware that multiple class selectors, that is, do not work below 6. And if you need compatibility with downlabel browsers then consider applying for user selection And resize your CSS

  .usertag {background: url ("/ images / tag.png");} .selected {background: url ("/ images / tag -Selected "") No duplication;}  

The user will override the selected usergate because it is later d Is absorbed.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -