I have an ASP.net MVC2 application. In which I use jQuery to change all the rows in a table, so I can click anywhere on any row to trigger a click event on a link in the clicked row.
Tables are created using MVC built into 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 fine. In IE, jQuery crashes when I click on a string.
If I debug the page in IE. I get it.
Out of stack space
On line jquery-1.4.1.js 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 not an eagle in javascript, so I'm pretty stuck.
Edit: IE had a problem with spaces in my window.open function in the click event. Having fixed this, I can now see that the click event really works, but it goes into Loop. I just click on the link until I get the "Stack errors" error.
Any thoughts on this?