This is a migrated thread and some comments may be shown as answers.

Custom jQuery inside Grid Functions

3 Answers 67 Views
Grid
This is a migrated thread and some comments may be shown as answers.
adrian
Top achievements
Rank 1
adrian asked on 12 Dec 2011, 05:11 PM
Hi all,
I got this template apply to a Grid
<script id="template" type="text/x-kendo-tmpl">   
<
tr>
<td>
  <
a href="a" class="something" value="#= id #">Show ID</a>       
</
td>
...

And I want that on click 

$(document).ready(function(){
   $(
'.something').click(function(){
        alert($(
this).attr("value"));
        
return false;
    });
...

but nothing happens, will if I apply this same jquery outside the Kendo Grid it's works OK.

So how should I bind the click to the template??

Thanks

3 Answers, 1 is accepted

Sort by
0
Brad
Top achievements
Rank 1
answered on 12 Dec 2011, 08:32 PM
My guess is that the element is not there when the event listener is being set. You could try 'live'.

$('.something').live('click', function(){
     alert($(this).attr("value"));
     return false;
 });
0
Brad
Top achievements
Rank 1
answered on 12 Dec 2011, 08:32 PM
My guess is that the element is not there when the event listener is being set. You could try 'live'.

$('.something').live('click', function(){
     alert($(this).attr("value"));
     return false;
 });
0
adrian
Top achievements
Rank 1
answered on 13 Dec 2011, 03:30 PM
That worked great. thanks a lot Brad
Tags
Grid
Asked by
adrian
Top achievements
Rank 1
Answers by
Brad
Top achievements
Rank 1
adrian
Top achievements
Rank 1
Share this question
or