[JQuery Practice] what button is clicked

find what button is clicked

<html xmlns="http://www.w3.org/1999/xhtml">
<title>
    JQuery Pratice
</title>
<head>
    <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js">
    <style>
		  .buttons{
			width: 100px;
			float: left;
			text-align: center;
			margin: 5px;
			border: 2px solid;
			font-weight: bold;
			}
    </style>
    
    <script type="text/javascript">

		$(document).ready(function() {
		  $('.bold').bind('click', function(){
		    alert('You have clicked the Bold button');
		  });
		
		  $('.italic').bind('click', function(){
		    alert('You have clicked the Italic button');
		  });
		});


    </script>   
   
</head>

<body>
	<span class="bold buttons">Bold</span>
	<span class="italic buttons">Italic</span>
</body>

</html>



Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s