Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8036155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:31:27+00:00 2026-06-05T02:31:27+00:00

hey i would like to show an table when user fills an input. What

  • 0

hey i would like to show an table when user fills an input.

What I have is:

in <head> section:

<script type="text/javascript">

//hide initially    
$("table#mytable").hide();

// show function
function showit() {
$("table#mytable").show();
}
</script>

and the table:

<table id="mytable"><tr><td>FOO</td><td>BAR</td></tr></table>

and a form below(maybe it is important) the table:

<form action="foobar.php">
<input name="example" onselect="showit()" />
<input type="submit" value="Send" />
</form>

I think onselect isn’t perfect but it should do the thing in my case.

The code above doesn’t hide the table at all. I don’t know what I did wrong. Hope some1 can find a mistake – thank you.

EDIT

here is the solution:

head:

<script type="text/javascript">
function show(id) {
    document.getElementById(id).style.display = 'block';
}
</script>

and in every element to hide just add style="display: none;" and edit input – add onkeyup="show('id') where id is id of element to hide e.g. #mytable

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T02:31:28+00:00Added an answer on June 5, 2026 at 2:31 am

    The reason it isn’t working is because you are calling the javascript before the table element is rendered. There are three ways of doing this:

    // Use CSS (best):
    <table style="display:none;" id="mytable">...</table>
    

    or

    // Using DOM Load event (wait for all of the elements to render) (second best)
    $(function() { $("table#mytable").hide(); });
    

    or

    // Put your javascript at the bottom of the page instead of the head. (not preferred)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey i would like do have your input on this I use this to
Hey, I have Arabic text in a txt file that I would like to
Hey guys, I have developed a small site that i would like to embed
Let's say I have the string Hey . I would like to determine all
Hey guys, I have some questions would like to ask: I wanna ask how
Hey all. So I have a collection of csv files which I would like
Hey guys, I would like to develop a light/laser show editor and simulator, and
Hey I would like to find a given text in an xml that looks
Hey all i have created dynamic buttons at runtime and i would like to
Hey I would like to know if there is a way to only take

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.