carlg
carlg

Reputation: 1812

Jquery selecting and clicking

I'm actually using an editable Telerik grid with ASP.NET MVC. One of the columns on the grid contains a delete button and I want to click this button using my own button which is placed somewhere else.

Here is how I get a reference to the currently selected grid row:

var selectedGRIDRows = $('#GRID tr.t-state-selected');

If I place the following statement in my code:

alert(selectedGRIDRows[0].cells[17].innerHTML);

the alert will show me the following: Delete

So how can I create my own jquery to click this button (Although I don't think it's really a button as it looks like a link styled to look like a button)?

Thanks for the help

Upvotes: 0

Views: 66

Answers (2)

Patricio Sapir
Patricio Sapir

Reputation: 1

$(selectedGRIDRows[0].cells[17]).trigger('click');

That should work...

Upvotes: 0

Buck Doyle
Buck Doyle

Reputation: 6387

$(selectedGRIDRows[0].cells[17]).trigger("click") should do it.

As @Rory McCrossan points out, this won’t actually click the button. Since I haven’t used this Telerik grid I’m not sure what sort of element the button is, but insert a selector for it here: $(selectedGRIDRows[0].cells[17]).find("[selector for button]").trigger("click")

Upvotes: 1

Related Questions