I am trying to make a table appear when I click on a submit button in a form.
I am using JavaScript for that function.
See code below:

```
<script type="text/javascript">
    function showTable1234() {
        var showtab = document.getElementsByClassName('container12');
        for(var i =0;i !=showtab.length;i++)
            showtab[i].style.display = 'block';
    }
</script>

```

Here is the code for the button which is calling the above function:

```
<button type="submit" class="btn btn-primary btn-block" onclick="showTable1234()">Submit</button>

```

This is div element which is to be shown on clicking the submit button:

```
<div class="container12" >
    <h2>Hover Rows</h2>           
    <table class="table table-hover" id = "tab12">
        <thead>
            <tr>
                <th>Firstname</th>
                <th>Lastname</th>
                .....

```

Now as soon as I run the code on the Chrome browser and clicking on submit button, table is visible only but only for mini second or something and the disappears.
It appears again when i click on submit button but again for same amount of time.

I even tried with this code but same result

```
<script type="text/javascript">
    function showTable1234() {
        var showtab = document.getElementsByClassName('container12')[0];
        for(var i =0;i !=showtab.length;i++)
            showtab[i].style.display = 'block';
    }
</script>

```

But for this i am getting this error

```
Uncaught TypeError: Cannot read property 'style' of undefined
    at showTable1234 

```

Advance Thanks for the help.