0

I have a javascript function that when the button is clicked it gets the content of the page, displays the text, and then fades it out. But, when it is clicked a second time, the text doesn't appear.

<script type="text/javascript">
$(document).ready(function(){
$("input[name=buttonup4206]").click(function(){
  $.ajax({url:"vote.php", success:function(result){
    $("#up4206").html(result);
    setTimeout(function(){$("#up4206").fadeOut('slow');},2000);
 }});
});});
</script>
<input type="image" name="buttonup4206" id="buttonup4206" src="vote.png"></input>
<div id="up4206"></div>

1 Answer 1

5

Once faded out, your element has display: none, so change this line to:

$("#up4206").css('display', 'block').html(result);
Sign up to request clarification or add additional context in comments.

3 Comments

@MarcelGwerder It is pretty much the same thing.
@elclanrs You got me, I didn't think about that!
@MarcelGwerder if you want to use display:block use .show(), else use .css('display').

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.