title: Getting Script on error on following Jquery function
body: <pre><code>var clickable = ApplyClickableLinkToClass($j(".rc_blueBtn"));
  setTimeout(clickable, 1000);
  </code></pre>
  
  <p>But if I call it like this there is no script error pop up :</p>
  
  <pre><code>ApplyClickableLinkToClass($j(".rc_blueBtn"));
  </code></pre>
  
  <p>The method is as follows :</p>
  
  <pre><code>ApplyClickableLinkToClass = function(selectedElements) {
      // Go through each of the passed in selections and try to apply a link to them
      $.each(selectedElements, function() {
          var linkElement = $("a:first:not(.do-not-apply-clickable-link)", $(this));
          var link = linkElement.attr("href");
          if (!IsNullEmptyOrUndefined(link)) {
              $(this).click(function(firstLink) {
                  var divToLink = firstLink;
                  return function() {
                      $(divToLink).unbind('click');
                      if (divToLink.attr("target") != "_blank") {
                          window.location = link;
                          return false;
                      }
                  };
              }(linkElement));
          }
      });
  }
  </code></pre>
  
  <p>The error is just a js popup "An error has occured in the Script on this page"</p>