onBlur Sent via AJAX Doesn't Fire

Posted on 2007-07-25
Last Modified: 2010-05-18
I'm using AJAX to make a call to an ASP page, which returns HTML that is then added to the page. Part of HTML being returned is an input box with an onblur event. Unfortunately, the onblur event isn't firing.

The returned HTML matches some static HTML in the page exactly, with the exception of some element IDs.

Here's the static code that's loaded with the page:

      <div id="static_<%=LocationID%>">
            <span id="text_<%=LocationID%>"><%=rsLocation("Conference_Location")%></span> <font size="1"><a href="javascript:edit('<%=LocationID%>')">(edit)</a></font>
      <div id="edit_<%=LocationID%>" style="display: none;">
            <input type="text" size="40" name="edit_location" id="input_<%=LocationID%>" value="<%=rsLocation("Conference_Location")%>" onblur="edit('<%=LocationID%>')" /> <span class="btn_style" onclick="saveEdit('<%=LocationID%>')">Save</span>

And here's the code in the ASP page that is sent via AJAX to the receiving page:

      Response.Write("<div id=""static_"&LocationID&""">")
            Response.Write("<span id=""text_"&LocationID&""">"&AddLocation&"</span> <font size=""1""><a href=""javascript:edit('"&LocationID&"')"">(edit)</a></font>")
      Response.Write("<div id=""edit_"&LocationID&""" style=""display:none;"">")
            Response.Write("<input type=""text"" size=""40"" name=""edit_location"" id=""input_"&LocationID&""" value="""&AddLocation&""" oblur=""alert('Hi there')"" /> <span class=""btn_style"" onclick=""saveEdit('"&LocationID&"')"">Save</span>")

As best I can tell, the two pieces of code are essentially exact matches.

I tried placing an alert directly inside the onblur event and it didn't fire, so I'm a bit confused. Any help would be appreciated.

Question by:Shiseiryu1
    LVL 1

    Accepted Solution

    Dude, your going to kick yourself over this one:

    AddLocation&""" oblur=""alert('Hi

    notice "oblur" vs onblur... done it many times... it always hurts :)

    Author Comment

    Wow, so much for them being just alike. :) Thanks for the help.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    A Change in PHP Behavior with Session Write Short Circuit ( (Winter 2014)** With the release of PHP 5.6 the session handler changed in a way that many think should be considered a bug.  See the note …
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    This video teaches users how to migrate an existing Wordpress website to a new domain.
    Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now