Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8295239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T14:31:04+00:00 2026-06-08T14:31:04+00:00

I have the following jQuery: $(‘#dataTable’).on(‘click’, ‘tbody tr’, clickHandler); Here’s the first few lines

  • 0

I have the following jQuery:

$('#dataTable').on('click', 'tbody tr', clickHandler);

Here’s the first few lines of my gridClickHander

function gridClickHandler(event) {
    $(oTable.fnSettings().aoData).each(function () {
        $(this.nTr).removeClass('row_selected');
    });
    $(this).addClass('row_selected');
    var rk = $(this).attr('data-rk');
    var pk = $(this).attr('data-pk');

This code now works very well.

Next I would like to do the same thing as the click event on a row but by using javascript/jQuery code calling the gridClickHandler. For example on a row with an id=”row_25″. Is there a way I can do this? Sorry but again I am confused abut how to deal with the $(this).

Here’s my code:

  if (obj.entity == "City") {
                var html = obj.$form.find("#select-topic").html();
                var indx = obj.$form.find("#select-topic").index()
                $("#input_TempRowKey_" + obj.rownum).html(html);
                $("#input_TempRowKey_" + obj.rownum).eq(indx).attr('selected', 'selected');
                var title = obj.$form.find("#Title").val();
                $("#input_Title_" + obj.rownum).val(title);
                $("tr#row_" + obj.rownum).attr("data-rk", json.rowKey);
                // here I need to do the same as though a user just clicked on rownum
            }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T14:31:06+00:00Added an answer on June 8, 2026 at 2:31 pm

    You can set this explicitly by using .call [MDN] or .apply [MDN]:

    gridClickHandler.call(referenceToDOMElement);
    // example: gridClickHandler.call($('#row_25').get(0));
    

    Note that the event handler expects this to be a DOM element, and not a jQuery object. Also, if your handler would make use of the event object (event) calling the function like this would of course not work.

    The above way lets you execute the handler for any DOM element. But since you want to execute the handler for a row, you can simulate a click on a specific row:

    $('#row_24').trigger('click');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following jQuery code: $(#dataTable tbody) .on(click, tr, function (event) { $(oTable.fnSettings().aoData).each(function
i have the following jQuery code. $(function() { $('.clickme').click(function() { $('.totalthing').slideToggle('slow','easeInOutQuart', function() { //
I have the following jquery script: $(function(){ $('#top-menu').on('click', 'a.change-menu', function(e){ e.preventDefault() $(#menu-change-div).load($(this).attr(href)); }); });
I have the following jQuery: $(form).submit(function() { //DO STUFF HERE }); But, it's not
I have the following jQuery code, which works fine: $(document).ready(function () { $('#link1').click(function ()
I have the following jQuery code: $('a[rel=close]').click(function() { alert('Close click!'); $('div#purchasePanel').hide(); }); This is
I have the following jquery code which works fine. $('#onlyTwo').click(function() { $(#textarea3).attr(disabled, true); $(#textarea4).attr(disabled,
I have following jQuery code $('a.editpo, a.resetpass').click(function(event){ event.preventDefault(); var urlToCall = $(this).attr('href'); var hyperlinkid
I have following jQuery .each loop : $('.table-data tbody tr td').each( function(index) { $('.table-data
I have the following jQuery Code: $(#menu span).click(function() { var url = this.getAttribute(data-url); var

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.