Change the background position of an element upon clicking a button - Javascript jQuery

Javascript examples for jQuery:Form Button

Description

Change the background position of an element upon clicking a button

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://code.jquery.com/jquery-1.7.1.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){//from ww  w.j av  a2 s  . c  o  m
$(':button').click(function() {
    $('p').css({'background-color': 'blue'});
});
    });

      </script> 
 </head> 
 <body> 
  <p> test test test test test </p> 
  <input type="button" value="Click me">  
 </body>
</html>

Related Tutorials