How to Remove a Scrollbar Programmatically in JavaScript
The JavaScript language lets you change any CSS class programmed on your HTML elements. A div container displays a scrollbar when the content exceeds the height or width of the container. Use JavaScript to remove a scrollbar so that one is never shown. You can also opt to have the content display beyond the container to make sure it's shown to the user.
Instructions
-
-
1
Right-click the HTML file you want to edit and select "Open With." Click your preferred JavaScript or HTML editor.
-
2
Locate the name of the HTML div you want to edit with JavaScript. You need the "ID" property to create the JavaScript function.
-
-
3
Add the following JavaScript to remove the scrollbar from the container:
document.getElementById("divid").style.overflow = "hidden";
This code stops any scrollbar from appearing in the container.
-
1