[jQuery] What's wrong with my slideUp slideDown?
Hi guys,
I have a simple md5 password encryption form and I'm using jQuery to
create an effect:
<script type="text/javascript">
$(document).ready(function(){
$("#encrypt").click(function(){
$("#encrypt").attr('disabled', true).val('In progress...');
$("#result").slideUp(0, slideUpCallback);
$("#result").slideDown(0, slideDownCallback);
});
function slideUpCallback()
{
if ($("#text").val() == '')
{
$("#result").html('You didnt enter the password!
');
}
else
{
$.ajax({
type: "POST",
url: "md5",
data: "text=" + $("#text").val(),
success: function(msg){
$("#result").html("The following '" + $("#text").val() + "' in
md5 is:
" +
"<b>" + msg + "</b>
");
}
});
}
}
function slideDownCallback()
{
$("#encrypt").attr('disabled', false).val('MD5!');
}
});
</script>
<input type="text" name="text" id="text" />
<input type="button" name="encrypt" id="encrypt" value="MD5!" />
<div id="result"></div>
The code is working perfectly except for the first time the result is
printed without the slide effect, after that everything is OK.
Please let me know what's wrong.
Thanks.