This is my code:
Let’s say that name is set to john
$("#first_table").append($('#second_table').find("tr:contains(" + name + ")"));
Basically I have 2 tables on my website. I would like to move elements from first to second, but only if they match completely. How can i do that?
Now if I have (for example) john john #1, john #2 in my table, they would all be moved. I would only like to move john and leave john #1 and john #2
Thanks!
EDIT:
I would like the code to work to match the variable name EXACTLY.
So if name is JOHN it must only get JOHN. If it’s JOHN #1, it must only get JOHN #1 and so on. Is this possible?
Since every name case is valid to
:contains(" + name +")statement, it matches all of them.Try this, with a
:notto omit the one with “#”Update:
If you want to be precise about the values inside. Then use something like this