Skip to content
Related Articles

Related Articles

Improve Article
How to move button in the same line with Checkbox and Textbox using JavaScript ?
  • Last Updated : 16 Jul, 2020

The style “display” property in HTML DOM is used to set elements to “display” property. To set the button in the same line with other elements of the web page is done using the inline property.

Syntax:

  • It returns the “display” property.
    object.style.display
  • It sets the “display” property.
    object.style.display = inline;

Example:




<!DOCTYPE html>
<html>
  
<head>
  
    <!-- script to set display property -->
    <script>
        function myGeeks() {
            document.getElementById("GFG")
                .style.display = "inline";
        
    </script>
</head>
  
<body>
    <div id="GFG">
        <input type="checkbox" checked> computer
        <input type="checkbox"> mobile
  
        <input type="text">
    </div>
  
    <button onclick="myGeeks()">
        Press
    </button>
</body>
  
</html>

Output:

  • Before click on the button:
  • After click on the button:
My Personal Notes arrow_drop_up
Recommended Articles
Page :