JQuery error in IE, works with FF. Maybe a problem with live.

Posted by olve on Stack Overflow See other posts from Stack Overflow or by olve
Published on 2010-05-07T15:46:57Z Indexed on 2010/05/07 15:58 UTC
Read the original article Hit count: 273

Hello.

I have an ASP.net MVC2 application. In wich I'm using JQuery to alter all table rows so I can click anywhere in any row to trigger a click event on a link in the clicked row.

The tables is created using MVC's built in partialview ajax.

Here is my JQuery script.

<script type="text/javascript">

        $(document).ready(function () {
            $('table tr').live('click',function (event) {
                $('#asplink', this).trigger('click');
            })
            .live('mouseenter',function (event) {
                this.bgColor = 'lightblue';                    
            })
            .live('mouseleave', function (event) {
                this.bgColor = 'white';
            });

        });

</script>

And this is the first part of the partial view code that creates the table.

<% foreach (var item in Model.JobHeaderData)
   { %>

    <tr>
        <td>
            <a id="asplink" href="http://localhost/sagstyring/EditJob.asp?JobDataID=<%: item.JobDataId %>&JobNumId=<%: item.JobNumID%>&JobNum=<%: item.JobNumID%>&DepId=1&User_Id=<%:ViewData["UserId"]%>" onclick="window.open(this.href,'Rediger sag <%: item.JobNumID %> ', 'status=0, toolbar=0, location=0, menubar=0, directories=0, resizeable=0, scrollbars=0, width=900, height=700'); return false;">Rediger</a>                 
        </td>

In firefox this works perfectly. In IE, JQuery crashes when I click on a row.

If I debug the page in IE. I get this.

Out of stack space

In jquery-1.4.1.js line 1822

 // Trigger the event, it is assumed that "handle" is a function
    var handle = jQuery.data( elem, "handle" );
    if ( handle ) {
        handle.apply( elem, data );
    }

I'm no eagle at javascript, so I'm pretty much stuck.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about asp.net-mvc