user1996496 user1996496 - 1 year ago 70
Javascript Question

disabling onclick with jQuery until page is loaded?

I have a button that works

. The problem is that it fails to work if the page is not fully loaded, so I want to disable it until the page is loaded and then enable it with jQuery.

<div class="btn btn-block" onclick="launchAction()">
<div class="launch"><i class="icon-launch"></i></div>

How would I do that? I tried to
it but that didn't stop onclick from working.

Answer Source

Do the following:

<div class="btn btn-block" id="mybutton">
<div class="launch"><i class="icon-launch"></i></div>

  $(document).ready(function() {
    $("#mybutton").click(function () {
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download