Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 67527

Div click event when div is inside a form

$
0
0

I have troubles to show an alert when a button (actually an input type=image object) is disabled because user should first to click on a terms checkbox. This is my jQuery code:

$('#divButton').on("click", function() {
    if ($('#buybutton').prop('disabled', true)) {
        alert('Please confirm . . .');
    }
});

And this is the HTML code:

<form>
      ...
        <div id="divButton">
            <input type="image" id="buybutton"...

        </div>
    </form>

When buybutton is disabled and I click inside divButton (over disabled button for example) nothing happens.

I am a mobile developer trying to write JavaScript code, so be patient with me.

What am I doing wrong?

EDIT: Debugging it on Chrome, when buybutton is disabled it is never entering inside divButton's click handler function to check

if ($('#buybutton').prop('disabled', true)).

Looks like onClick event in that div be disabled.


Viewing all articles
Browse latest Browse all 67527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>