Skip to content
Advertisement

How to put only one table td into an array

I have a table like this:

JavaScript

I want to put the td “empid” into an array. Here’s what I’ve done so far:

JavaScript

It adds the whole td’s to array though, I’m wondering how to add only a td to array. thank you

Advertisement

Answer

You need assign an id to your empID input to be able to find it from the table.

For that you can use .find() function and to get the input value just use .val() function.

Live Demo:

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