javascript - jquery simple onclick event -


<a aria-expanded="false" data-toggle="tab" href="#pictures">    <i class="pink ace-icon fa fa-gift bigger-120"></i>     pictures </a> 

i want wire on click #picture event alert message add

 $(document.ready(function() {         $("#pictures").click(function(){             alert('clicked!');                        });  }) 

but doesnt work, i've got no error messages inside firebug console. jquery loaded before correctly.

in html there no element id pictures, change it,

$("#pictures").click(function(){    alert('clicked!');                 });    // or use selector this, if can't change html  $('a[href="#pictures"').click(function(){    alert('clicked!');                 }); 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>    <a aria-expanded="false" data-toggle="tab" href="#pictures" id="pictures">     <i class="pink ace-icon fa fa-gift bigger-120"></i>      pictures  </a>

update:

also have error in line

$(document.ready(function() { 

change it

$(function() {    // put code });  

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? -