Azzerik
Azzerik

Reputation: 13

dblclick event on tr doesn't work

I ve got a html page with only a table with two rows and i want to add an dobleclick event via jQuery. My problem is that this code don´t run, but if i use javascript console of chrome and type manually the code, code runs.

$(document).ready(function () {
$('tr').dblclick(function(){
alert('Row dblclicked');
});
}

What's the problem?

Upvotes: 0

Views: 491

Answers (3)

Benoît
Benoît

Reputation: 7427

You just have a syntaxt problem:

$(document).ready(function () {
  $('tr').dblclick(function(){
    alert('Row dblclicked');
  });
}​);​

and it works: http://jsfiddle.net/bouillard/xGgFx/

Upvotes: 0

John Shepard
John Shepard

Reputation: 947

Fiddle here:

http://jsfiddle.net/LUNuq/

Upvotes: 0

Curtis
Curtis

Reputation: 103388

The issue is because you are not ending your parentheses for $(document).ready()

You are missing ); right at the end of your script.

Try changing your code to:

$(document).ready(function() {
$('tr').dblclick(function(){
alert('Row dblclicked');
});
});

http://jsfiddle.net/Curt/SQzt6/4/

Upvotes: 2

Related Questions