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 7779843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T18:44:59+00:00 2026-06-01T18:44:59+00:00

I am a beginner in JQ grid. In my JQ grid I have a

  • 0

I am a beginner in JQ grid. In my JQ grid I have a image in a column added as an anchor tag. Onclick of the particular cell I need to change the image only for that cell. I am adding a class ‘clickableTitle’ to the column and trying to access the current cell as:

$('.clickableTitle').live('click', function () {
    $(this).parents('table:first').getCell($(this).parents('tr:first').attr('id'), 'comment'));
 });

This gives me the anchor tag in below format, but I am not able to change its image source at runtime.

<A href="Proj.aspx?PID=795&Store=#Comment"><IMG class=commentIcon src="/_Layouts/images/iconCommentOn.png"></A>

Can you please let me know what would be the best way to achieve this. Thanks!!!

  • 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-01T18:45:00+00:00Added an answer on June 1, 2026 at 6:45 pm

    First of all the name of the JavaScript library which you try to use: jqGrid. Everywhere in the documentation or on the main side you will find the same name written in exact the same form.

    To your main question. It seems you can just use onCellSelect callback to catch the click event on the image or just a click on some cell. The e parameter of the onCellSelect callback is the event object and the e.target will the the element which was clicked.

    The demo demonstrate how you can use it.

    enter image description here

    I used as the initial background image of jQuery UI for the lock.

    formatter: function () {
        return "<a href='#'><span class='ui-icon ui-icon-locked'></span></a>"
    }
    

    Clicking on the image changed the image by changing the class on the <span> element from "ui-icon-locked" to "ui-icon-unlocked":

    onCellSelect: function (rowid, iCol, cellcontent, e) {
        var $dest = $(e.target), $td = $dest.closest('td');
        if ($td.hasClass("clickableTitle")) {
            if ($dest.hasClass("ui-icon-locked")) {
                $dest.removeClass("ui-icon-locked").addClass("ui-icon-unlocked");
            } else {
                $dest.removeClass("ui-icon-unlocked").addClass("ui-icon-locked");
            }
        }
    }
    

    You can easy change the code if you prefer to have <img> instead of background image in <span>.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am a beginner to WPF . I have a data grid for showing
Beginner level question Scenario: Have simple string cocantation tool, that I might expand later
Beginner. I have a tab control that has content loaded dynamically via links. These
Beginner rails/javascript question: Let's say that I have a simple Circle model in a
beginner to python here. I have 2 nested lists that I want to merge:
Beginner iOS dev here. I have a problem in my array. Im making an
Beginner in Android development. My code crashes. I have made a simple Java method
Beginner question: I have a dictionary where the values are lists of (a variable
JS beginner here. I need help with a script to place different content in
Python beginner here, I have a list of lists and want to refer to

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.