Skip to content
Advertisement

How can I pass a hidden html element`s value to jQuery?

I have a hidden element with a PHP dynamic value in HTML and I would like to get it in jQuery when I click in a row of the table where the value is. Right now I can click on a row and get the value of the first column of that row but it prints the entire element as a string.

JavaScript

jquery code:

JavaScript

this is what it prints: “<input type="hidden" name="zyx" value="test id">

Advertisement

Answer

You can simply use .find to find the first input inside the first td found inside the clicked row:

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement