0

I need to call a javascript function from a span tag on kendo ui grid. I've implemented as below, but it isn't work. // Kendoui grid

c.Template(m => { }).ClientTemplate(@"<a><span class='k-icon k-i-plus hide-row-grid'></span></a>");

// Javascript

$('.hide-row-grid').click(function () {
        alert('hide button click');
    });

Please help me resolve it. Thanks

5
  • Solution may be event delegation. Commented Jun 16, 2014 at 4:07
  • Hi @AnoopJoshi, I don't understand your comment, please explain details for me. Commented Jun 16, 2014 at 4:08
  • first of all you should enclose the event in $(document).ready(function(){}); If that doesnt work, try with $(document).on("click",".hide-row-grid",function(){}); Commented Jun 16, 2014 at 4:09
  • 1
    Try with this code $(document).on("click",".hide-row-grid",function(){alert('hide button click');}); Commented Jun 16, 2014 at 4:11
  • I use the code: $(document).on("click",".hide-row-grid",function(){alert('hide button click');}); and it works. Thanks @AnoopJoshi. Commented Jun 16, 2014 at 4:13

1 Answer 1

1

USe event delegation for binding events to dynamically creating objects,

$(document).on("click", ".hide-row-grid", function () {
    alert('hide button click');
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.