SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    May 2008
    Location
    Brisbane, Australia
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    return confirm - not working in IE

    I have the following code that I use on links for delete scripts and it doesn't seem to be working in IE, when you hit cancel it still follows though with the link. Firefox is fine. Is there something I need to change to allow it to work in all browsers?


    Code JavaScript:
    onclick="return confirm('Are you sure you want to delete this?')"

    I also tried the following using JavaScript, the same thing happens, cancel still follows though with the script.

    Code JavaScript:
    $('.deleteItemLink').click(function() 
    {
    	return confirm('Do you really wanna delete this?');
    });
    Last edited by leerox; Jan 20, 2011 at 17:35. Reason: Additional Code Added

  2. #2
    Non-Member
    Join Date
    Jan 2011
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This works in IE7.
    hth.

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
        <head>
            <title></title>
            <script type="text/javascript">
                function confirmDelete(){
                    return window.confirm('Are you sure you want to delete this?');
                }
            </script>
        </head>
        <body>
            <table>
                <tr>
                    <td>Some item with an id</td>
                    <td><a href="deleteScript.php?id=xxx" onclick="return confirmDelete();">Delete</a></td>
                </tr>
            </table>
    
        </body>
    </html>

  3. #3
    SitePoint Enthusiast
    Join Date
    May 2008
    Location
    Brisbane, Australia
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thankyou, I have discovered that the code I use is working in IE when stripped out however I have something else stopping it from working correctly in my code, any idea how I can find out what might be causing this to continue though anyway?

  4. #4
    SitePoint Enthusiast
    Join Date
    May 2008
    Location
    Brisbane, Australia
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I did some isolation testing and discovered the issue is http://www.flexigrid.info/ within jQuery... Anyone had this issue before and found a solution?

  5. #5
    SitePoint Enthusiast
    Join Date
    May 2008
    Location
    Brisbane, Australia
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have found the issue, within flexgrid.js there is the following code basically changing the table row class on click which seemed to override my JavaScript.

    As I didn't need this part I simply removed it.

    Thanks

    Code JavaScript:
    .click(
    	function (e) 
    		{ 
    			var obj = (e.target || e.srcElement); if (obj.href || obj.type) return true;
    			$(this).toggleClass('trSelected');
    			if (p.singleSelect) $(this).siblings().removeClass('trSelected');
    		}
    )


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •