Event binding to buttons in FireFox requires an alert() box

Event binding to buttons in FireFox requires an alert() box

Hey

I have a piece of javasacript code that searches through several iframes for buttons with specifi id's. When I find the button, I bind a click event to that button. This works perfectly fine in IE, but only works in Firefox if I alert something. After I click on the alert button ok, the click events are assigned correctly and the buttons work fine. See my code below for achieving this:

  1.           $.each(iframe, function(index, ifrm) {
             
                 // Add target="_blank" to text hyper links
                 var hyper = null, hyperCount = 0;
                 hyper = $(ifrm).contents().find("a");            
                 hyperCount = hyper.length;
                 for (var t = 0; t < hyperCount; t++) {
                    if (!$(hyper[t]).attr("target")) {
                       $(hyper[t]).attr("target", "_blank");
                    }
                 }
                 // end here

                 var tmp = $("#hdnButtonActions-" + index).val();
                 if (tmp !== "") {
                    var actions = tmp.split(",");
                    for (var i = 0; i < actions.length; i++) {
                       var button = actions[i].split("=");
                       var id = button[0];
                       var targetType = button[1];
                       var target = button[2];
                       var targetIndex = button[3];

                       if (targetType === "Page") {                                        
                          $(ifrm)
                             .contents()
                             .find("button[id='" + id + "']")
                             .bind('click', { inx: eval(button[3]) }, pageHandler);                                                 
                       }
                       if (targetType === "Link") {
                          $(ifrm)
                             .contents()
                             .find("button[id='" + id + "']")                 
                             .bind('click', { url: button[2] }, linkHandler);
                       }
                    }
                 }
              });  

              function pageHandler(event) {
                 $tabs.tabs('enable', event.data.inx);
                 $tabs.tabs('select', event.data.inx);
                 return;
              }

              function linkHandler(event) {
                 window.open("http://" + event.data.url);
                 return;
              }

















































The click events either allows for a user to navigate to a specific jquery ui tab, or navigate to an external url which opens in a new window