Skip to content
Advertisement

How to get a value from the closest with a specific class name?

Im using Jeditable inside a table, to update a value.

JavaScript

The table looks like this:

JavaScript

I want to pass the value inside

JavaScript

when i use AJAX to post a value, but im not sure how to get the value. Im using:

JavaScript

which is returning null.

How do i get the value?

Advertisement

Answer

You should do

JavaScript

because closest() goes up the DOM tree, while find() goes down. You can’t use prev() because it returns just the preovious element

Advertisement