Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

_Zaman's avatar

if click button will show date and time and button will be hide.

Hi, I am trying to make a submit button that will show current date and time when clicked and then the button will be hidden. I saw an example but it showing GMT and current location name. So how can I replace button and show the time and date in that button location? The in my table column so I just show time in that column.

$(document).ready(function() { $("#hide").click(function() { $("#button-to-hide").hide(); $("p1").show(); });
    });
    $('#button-to-hide').hide();    
Hide
0 likes
2 replies
cmdobueno's avatar
$(document).ready(function(){

    $(document).on("click","#button-to-hide",function(){
        $("#time-to-show").show();
        $("#button-to-hide").hide();
    });

});

That should work

_Zaman's avatar

my HTML code is missing. I want to hide the button when click at a time it will show the current time and date.

$(document).ready(function(){ $("#hide").click(function(){ $("#button-to-hide").hide(); $("p1").show(); });

});

Hide

Please or to participate in this conversation.