1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to access a textbox in a table using ID?

Discussion in 'JavaScript' started by michael meier, Aug 9, 2017.

  1. #1
    I know this is really simple, but I just can't get it. I want to read the contents of an INPUT textbox with id="myTextbox" within a table cell as shown below:

    <table>
    <tr>
    <td>Textbox</td><td><input type="text" id="myTextbox'></input></td>
    </tr>
    </table>

    thanks
     
    michael meier, Aug 9, 2017 IP
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    
    var value = document.getElementById('myTextbox').value;
    
    Code (markup):
    should work?
     
    PoPSiCLe, Aug 10, 2017 IP
  3. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #3
    Meanwhile I'd be questioning why it's in a table much less a table data cell, and why the text next to it isn't in a proper LABEL tag with a FOR attribute.
     
    deathshadow, Aug 12, 2017 IP
  4. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #4
    Now you're asking sensible question about noobcode. You should know better :D
     
    PoPSiCLe, Aug 12, 2017 IP