# How to ADD scroll bar to html table without hiding table heading

**URL:** <https://www.phphelp.com/t/how-to-add-scroll-bar-to-html-table-without-hiding-table-heading/22262>\
**Category:** Javascript & Ajax\
**Created:** [March 7, 2014, 9:28am UTC](https://www.phphelp.com/t/how-to-add-scroll-bar-to-html-table-without-hiding-table-heading/22262 "2014-03-07T09:28:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pankajdurve](https://www.phphelp.com/letter_avatar_proxy/v4/letter/p/b9bd4f/32.png) [@pankajdurve](https://www.phphelp.com/u/pankajdurve)\
**Post date:** [March 7, 2014, 9:28am UTC](https://www.phphelp.com/t/how-to-add-scroll-bar-to-html-table-without-hiding-table-heading/22262/1 "2014-03-07T09:28:25Z")

</div>

I written a program which adds scrollbars to html table…without hiding html heading.  
Please help me  
THIS PROGRAM IS EXECUTE SUCCESSFULLY…BUT NOT SHOWING SCROLLBAR

 User Profile List 

```
            </style>
	<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
            <script>
	      function getdata() 
                  {
			var val=$("#txt").val();
                            $.getJSON('database.php',{age:val},function(data){
			  if(data.length>0) 
                              {$('#error').html("");
				var table = '<table border="1" id="bus_ser">';
				table += '<tr><td>'
                                         + 'User Information'
                                         + '</td><td>age</td></tr>';
                                     
			         $.each(data,function(i,element){
					table +='<tbody id="bus"><tr><td>' + element.id+'</td><td>'+element.age+'</td></tr></tbody>';
			             
                            });
				table +='</table>';  
                                $('#user_profile_content').html(table); 
			
			 }
			else {
					$('#error').html("no data found"); 
                                            $('#user_profile_content').html("");
				}
			}); 
		}
	</script>
</head>
<body>
	
        <div id="user_profile_content" ></div>
            <div id="error"></div>
            <input type="text" id="txt" >
            <input type="submit" value="submit" onclick="getdata();">
</body>

```

---

<div class="post-metadata">

**Author:** ![benanamen](https://www.phphelp.com/user_avatar/www.phphelp.com/benanamen/32/287_2.png) [@benanamen](https://www.phphelp.com/u/benanamen)\
**Post date:** [April 8, 2014, 4:06pm UTC](https://www.phphelp.com/t/how-to-add-scroll-bar-to-html-table-without-hiding-table-heading/22262/2 "2014-04-08T16:06:47Z")

</div>

I didn’t check out your code, but are you getting enough data for for the scroll bar to show?

---

<div class="post-metadata">

**Author:** ![Elizabeth\_Keen](https://www.phphelp.com/letter_avatar_proxy/v4/letter/e/dfb087/32.png) [@Elizabeth\_Keen](https://www.phphelp.com/u/Elizabeth_Keen)\
**Post date:** [September 23, 2014, 5:03pm UTC](https://www.phphelp.com/t/how-to-add-scroll-bar-to-html-table-without-hiding-table-heading/22262/3 "2014-09-23T17:03:01Z")

</div>

Something like this?

[http://jsfiddle.net/TweNm/](http://jsfiddle.net/TweNm/)

The idea is to wrap the

 in a non-statically positioned 
 which has an overflow:auto CSS property. Then position the elements in the 
 absolutely.

For Web Apps visit [ati-erp.com](http://ati-erp.com)

---

<div class="post-metadata">

**Author:** ![Strider64](https://www.phphelp.com/user_avatar/www.phphelp.com/strider64/32/3161_2.png) [@Strider64](https://www.phphelp.com/u/Strider64)\
**Post date:** [September 27, 2014, 1:28pm UTC](https://www.phphelp.com/t/how-to-add-scroll-bar-to-html-table-without-hiding-table-heading/22262/4 "2014-09-27T13:28:36Z")

</div>

Just an example but maybe something like this `body {height:101%; }` or in the

 tag itself?
