Jump to content

Is it possible to replace a div or button on click?


man5

Recommended Posts

I have an alternate way:
<!DOCTYPE html>
<html lang="en">
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<style>
</style>
</head>
<body>
<button class="button1">button 1</button> 
<button class="button2">button 2</button> 

<script>
	
$(document).ready(function(){
	
    $(".button1").click(function(){
		
        $(".button1").hide();
		$(".button2").show();
        });
		
		$(".button2").click(function(){
		
        $(".button2").hide();
		$(".button1").show();
       });
    });
	
	
</script>

</form>
</body>
</html>

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.