how to make a textbox visible

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ashima515
    New Member
    • Nov 2006
    • 40

    how to make a textbox visible

    Hi..
    I have made a table in html whose first column contains checkboxes...On click of a checkbox i want a textbox to appear in that corresponding row....I have made a textbox but initially it's vixsibility is set to false...How can i make it visible for a particular row using javascript or anything related...

    Thanks & Regards,
    Ashima
  • hsriat
    Recognized Expert Top Contributor
    • Jan 2008
    • 1653

    #2
    Originally posted by ashima515
    Hi..
    I have made a table in html whose first column contains checkboxes...On click of a checkbox i want a textbox to appear in that corresponding row....I have made a textbox but initially it's vixsibility is set to false...How can i make it visible for a particular row using javascript or anything related...

    Thanks & Regards,
    Ashima
    [html]<input type="checkbox" id="ch01" onclick="showIn p(this)" /><input type="text" id="tch01" />[/html][code=javascript]function showInp(x) {
    document.getEle mentById('t'+x. id).style.visib ility = x.checked ? 'visible' : 'hidden';
    //or use this
    //document.getEle mentById('t'+x. id).style.displ ay = x.checked ? '' : 'none';
    }[/code]
    Initially, set visibility:hidd en instead of visibility:true

    And in case of display, initially use display:none

    And prefix t to the id of checkbox to make the id of the text input.

    Comment

    Working...