toggleClass in jQuery -
i cant toggleclass work, here's jsfiddle: http://jsfiddle.net/edddotcom/v6vhx/
clicking on image supposed make text change colour removing .mid class not doing @ moment.
here's javascript:
$(document).ready(function(){ $("#image").click(function(){ $("p").toggleclass(".mid"); }); });
and html
<div class="container"> <div class="row"> <p>hello</p> <p class="mid">hello</p> <img id="image" src="http://icons.iconarchive.com/icons/artua/mac/512/earth-icon.png"/> </div> </div>
the css saying .mid class red text, if need see jsfiddle,
what missing/doing wrong?
with toggleclass, leading dot before class name not required.
$("p").toggleclass("mid");