jquery - Change Div Style by using JavaScript without page reloading -


i tried change background color div using javascript, changes didn't applied because when press on button browser make reload page , restore default setting without change.

how can change background color div without page reload or changes applied?

here's code using jquery changes background without reloading:

<!doctype html> <html> <head>   <meta charset="utf-8">   <title>changing div background color</title>   <script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>   <style>   #changing_background {     background-color: red;     min-height: 200px;   }   </style> </head> <body>  <div id="changing_background"></div>  <button id="change_background">click me</button>  <script>   $("#change_background").click(function(e){     $("#changing_background").css("background-color", "blue");   }); </script>  </body> </html> 

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -