javascript - toggleClass in jquery dosent work when i use id selector in Css -


i'm new @ jquery , have problem when use id selector in css jquery code doesn't work.

here html:

<body>         <div id="fm">     </div> </body> 

here javascript code:

$(function () {     $("#fm").click(function () {         $(this).toggleclass("cm");     }); }); 

this css ok , works:

body>div{      height:100px;     background-color:blue;     transition:all ease 0.5s;     position:fixed;     top:0;     left:0;     bottom:100px;     right:0;     z-index:1000; } 

but if use #fm in css selector doesn't work. think may because of cascading behavior don't know how fix it.

here css doesn't work:

#fm{      height:100px;     background-color:blue;     transition:all ease 0.5s;     position:fixed;     top:0;     left:0;     bottom:100px;     right:0;     z-index:1000;     border:1px solid black; } 

and cm class

.cm {     background-color:red;     height:150px; } 

i appreciate if help

try

#fm.cm 

for cm rule. way, id doesn't override class


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -