Jquery not working properly? -
i'm having trouble jquery.
@ end of page, before closing </body> tag, have included jquery cdn:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script> then @ top, in <head>, included own little code:
<script> $(document).ready(function() { $('#liked').click(function() { $('#changed').addclass('likeclicked'); }); }); </script> this affecting following:
<button id='changed' class="like"> <span class="glyphicon glyphicon-heart" id='liked' style="font-size:2.0em;"></span> </button> however, code isn't working. (css below). i've tried changing jquery hover instead of click, different classes or elements instead of id's. don't know i'm doing wrong.. idea? thanks.
.like { -webkit-appearance: none; outline: none; border: 0; background: transparent; -webkit-transition-duration: 0.2s; -moz-transition-duration: 0.2s; transition-duration: 0.2s; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .likeclicked { color: #00bc0e; }
order of loading important. code dependent on jquery library library needs load before code.
if in browser console see error $ not defined. stop further script execution in page
Comments
Post a Comment