Open In App

How to move button in the same line with Checkbox and Textbox using JavaScript ?

Last Updated : 25 Jan, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

The style “display” property in HTML DOM is used to set elements to the “display” property. To set the button in the same line as 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: In this example, the press button will be placed in the same in the same line as of checkboxes on clicking it.

html




<body>
    <script>
        function myGeeks() {
            document.getElementById("GFG")
                .style.display = "inline";
        }
    </script>
      
    <div id="GFG">
        <input type="checkbox" checked> computer
        <input type="checkbox"> mobile
      
        <input type="text">
    </div>
      
    <button onclick="myGeeks()">
        Press
    </button>
</body>


Output:

move button in the same line with Checkbox and Textbox using JavaScript

move button in the same line with Checkbox and Textbox using JavaScript


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads