I'm having trouble with this code. Whenever i clicked the button to show the hidden text, it displays the text but only like for 1 second and hides again. Am i missing or something?

$(document).ready(function(){
$("h3").hide();

$(window).load(function(){
  $('#loginbutton').click(function(){
    $("h3").show();


});
});
});

Recommended Answers

All 2 Replies

Here is some working code you can adapt to your needs....

<h3>Content</h3>
<button id="loginbutton">Click</button>  
<script>
  $(document).ready(function(){
     $("h3").hide();
     $('#loginbutton').click(function(){
       $("h3").show();
     });
  });
</script>

Dude, i love you! Thank you very much.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.