.click() on image does not work as expected
javascript code:
$(document).ready(function() {
$(".delRo开发者_运维技巧w").click('function() {
alert("hello!");
});
});
html code:
<img src="../images/delete.png" alt="delete" class="delRow"></img>
This code seems straight forward; however, it is not working as expected. Are images handled differently when using .click?
-Thanks,
Rich$(document).ready(function() {
$(".delRow").click(function() {
alert("hello!");
});
});
WORKING DEMO
You have extra ' at click.(function(){
It should be
$(document).ready(function() {
$(".delRow").click(function() {
alert("hello!");
});
});
$(document).ready(function() {
$(".delRow").click(function() {
alert("hello!");
});
});
Remove the " '
" before the second function
精彩评论