Link to home
Create AccountLog in
Avatar of Whing Dela Cruz
Whing Dela CruzFlag for Anguilla

asked on

Read text on Table

Hi experts, I need to change the html into value since the source "sTable7" is type text.  I have tried this tr.find('td:eq(1)').value; but not working.

<script>
$(function() {
  $(document ).on("click","#sTable7 button.iAddbutton",function() {
    let tr = $(this).closest('tr');
    let a = tr.find('td:eq(1)').html();
    let b = tr.find('td:eq(2)').html(); 
    
    alert(a);    
  });
});
</script>

Open in new window

SOLUTION
Avatar of Big Monty
Big Monty
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of Whing Dela Cruz

ASKER

Yes Monte, It's a text field, I tried your code but it seems not working the alert shows no data. But i will double check it now. Thanks!
can you set up something on jsFiddle?
Thanks I'll do it now..
ASKER CERTIFIED SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Sorry Big Monty for was not able to post on jsfiddle I'm having trouble to re-arrange the code to run on it. Thank you Julian for providing the code, it works very find! More power to both of you guys and God Bless!
You are welcome.