How to switch between some divs and disable other?

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Test</title>
    <body>
        <div>
            <button id="btn1">Show Avia</button>
            <button id="btn2">Show train</button>
        </div>
<!-- <div>
            <button id="btn1">Show Avia</button>
            <button id="btn2">Show train</button>
        </div> -->
        
        <div id="avia">	
        	<input type="text" placeholder="Avia">
        </div>

        	<div id="train">	
        		<input type="text" placeholder="Train">
        	</div>

        <script type="text/javascript">
            document.getElementById('btn1').onclick=function(){showdiv('avia');}
            document.getElementById('btn2').onclick=function(){showdiv('train');}
            function showdiv(fileName){
                document.getElementById('avia').src = fileName;
            }
        </script>
    </body>

</body>
</html>

Welcome to the forums, @mirvokhidstart. I really don’t understand your post. Could you please elaborate?

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Test</title>
    <body>
        <div>
            <button id="btn1">Show Avia</button>
            <button id="btn2">Show train</button>
        </div>
        
        <div id="avia">	
        	<input type="text" placeholder="Avia">
        </div>

        	<div id="train">	
        		<input type="text" placeholder="Train">
        	</div>

        <script type="text/javascript">
            document.getElementById('btn1').onclick=function(){showdiv('avia');}
            document.getElementById('btn2').onclick=function(){showdiv('train');}
            function showdiv(fileName){
                document.getElementById('avia').src = fileName;
            }
        </script>
    </body>
</body>
</html> 

this website ignores to show part of code it is

<div>
            <button id="btn1">Show Avia</button>
            <button id="btn2">Show train</button>
        </div> 

@mirvokhidstart when you post code in the forum, you need to format it. To do so you can either select all the code and click the </> button, or type 3 backticks ``` on a separate line both before and after the code block.

I think this may be part of your problem, but you still haven;t explained what your question is.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.