简体   繁体   中英

Click event on <div> not firing on Firefox but fires on Chrome

I have a click event on a div feedbackInput

<div id="feedbackInput" class="input-group">
      <div class="input-group-prepend">
        <span class="input-group-text mr-2"><i class="fas fa-bullhorn"></i></span>
      </div>
      <input disabled class="form-control feedback-input" placeholder="Feedback about this page?" style="">
</div>

I added a click event like so:

$("#feedbackInput").click(function(e) {
    console.log("clicked")
});

I tested on Chrome and this works fine, i can't seem to figure out why this simple code doesn't work on FireFox.

If possible, i want to avoid using onclick() on the HTML element.

Anyone know why this doesn't work on Firefox?

FireFox won't accept the click event on the disabled input only

but <div class="input-group-prepend"> works fine

在此处输入图片说明

Use READONLY instead

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM