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

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:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!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>

chevron_right


Output:

  • Before click on the button:
  • After click on the button:

full-stack-img

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.