Skip to content Skip to sidebar Skip to footer

Accessing Clicked Cell Instead Of All Cells Using Jquery And Ajax

I am trying to edit a specific cell once it's clicked. When I click a cell currently it turns all the td into textboxes. I would like only the clicked cell do that. How can I acces

Solution 1:

You are currently telling ALL text and editbox to hide and show respectively whenever you click something. What you want to do is ONLY make the one related to the element you are clicking hide and show.

To do that, you will want to do something along the lines of

$(".edit_tr").click(function() {
    $(this).children(".text").hide();
    $(this).children(".editbox").show();
}) // your normal stuff can go here.

This will grab and modify ONLY the children of the class edit_tr and show/hide the items you want.

Solution 2:

you can use this object.

$(this).find(".text").hide();
$(this).find(".editbox").show();

It will access current row rather than all of td of your code.

Post a Comment for "Accessing Clicked Cell Instead Of All Cells Using Jquery And Ajax"