Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Oct 2013
    Thanked 0 Times in 0 Posts

    Alert freezes page

    I'm using an alert to make sure a .change is working on a file input. The alert works fine in firefox and chrome, but it freezes the page when run on an iphone. Here is the code in question.

    $('#photofile').change(function() {
    alert("Change recognized");

    Anyone know why this is happening? Thanks in advance.

  • #2
    Regular Coder
    Join Date
    Jan 2013
    Thanked 77 Times in 77 Posts
    I'm not sure what you mean by "it freezes the page", but alert is a blocking operation that stops Javascript execution until the user clicks "OK".

    If you don't want that, don't use alert. Which you shouldn't anyway. It is generally recommended not to use alert or prompt, but to use DOM methods instead. Imagine you are a user on a site and if you change something, you get these annoying alert notifications all the time. It's not a good user experience. Show a little text next to what changed, open up a little tooltip kind of notification, etc. pp. There are many ways, but alert is not a good one.


    Tags for this Thread

    Posting Permissions

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