users online jQuery - 2 - An Example - Software Training Video Tutorials






jQuery - 2 - An Example

HTML Code :

<!doctype html>
<html lang="en">
<head>
 <meta charset="utf-8">
 <title>JQuery Example</title>
</head>
<body>
 <input type="button" value="hide" id="toggle_message"/>
 <p id="message">you can see this paragraph</p>
 <script type="text/javascript" src="js/jquery.js"></script>
 <script type="text/javascript" src="js/toggle.js"></script>
</body>
</html>

JQuery Code :

$('#toggle_message').click(function(){
var value  = $('#toggle_message').attr('value');
$('#message').toggle('fast');
});
if(value=='Hide'){
 $('#toggle_message').attr('value','Show');
}else if(value=='Show'){
 $('#toggle_message').attr('value','Hide');
}
});

Labels:




Leave A Comment: