JQuery - confirm () not working in IE

I have a lightweight script that works in all browsers except IE (8, haven't tried lower versions yet).

$('.deleteItemIcon').click(function() {
    var deleteConfirm = confirm('Do you really wanna delete that item?')
    if (!deleteConfirm) {
        return false;
    }
});

      

Can you see the reason why this shouldn't work, if so how to get it to work?

+2


a source to share


7 replies


Just curious, for those who don't work with this code ... are you using IETester? I had a few problems with IE8 (when using IETester) and once I actually took 20 minutes to upgrade to ie8 I found the code worked ... Just a thought. One more note, I went through and made sure IETester is fully updated and still have issues. Acknowledgments and warnings don't work as expected (if at all ...) for ie8.



+4


a source


Possibly missing half columns after confirmation?

Why not just change it to



return confirm('Do you really wanna delete that item?');

      

+2


a source


$('.deleteItemIcon').click(function() {
return confirm('Do you really wanna delete that');
});

      

try this like

you don't need to specify the confirmation in the variable and check it after returning false. Confirm already returns true

or false

so you can just return the result confirm()

.

+1


a source


I had this problem with IE 9.0.39 and noticed the usage console.log("")

was a problem.

Once I commented out this line of code, it worked great.

+1


a source


I think this is your volume.

You must use

var confirmed = window.confirm('Do you really wanna delete that item?');

It now works for me in firefox; However, I don't know about IE.

0


a source


My HTML:

<a href="/default.aspx?mode=Reset" id="rstPrtlts">Reset to default layout</a>

      

This works in Chrome, but not IE:

$('#rstPrtlts').click( function() {return confirm('This will reset your widgets on the homepage. Are you sure?');});

      

However, I have very similar code on the page that works. It's worth noting that the code I mean is a .js file downloaded from a static server.

This works in both Chrome and IE:

$('#rstPrtlts').click( function(e) {if(confirm('This will reset your widgets on the homepage. Are you sure?')) { window.location = e.currentTarget.href;}});

      

Not sure why the first code won't work. I've heard several reasons IE blocks functions that always return false, etc. Etc.

0


a source


I had the same problem and window.confirm ("Text") worked for me in IE, Crome and Firefox.

0


a source







All Articles