JS functions are not getting in IE anchor tags RRS feed

  • Question

  • I tried to disable the previous button (l-arrow in the JSP code) in very first vacancy in a list of vacancies. And also want to disable next (r-arrow in the JSP code) button in very last vacancy in a list view. Now in IE browsers if I click the previous button in very first vacancy it is redirecting to a blank page. It is the same as the next button in very last vacancy in the list view. But next and previous buttons are not exactly button. They are inside anchor tags. This problem is only happening with IE browser. All other browsers are okay. I will mention the HTML code and javascript code below.

    JSP code:

    <div class="job-title-header col-xs-12 col-sm-12 col-md-12 col-lg-12 
        <c:when test="${not empty rid && rid ne 'null'}">
            <a class="l-arrow fa fa-angle-left col-xs-2" href="javascript:loadPrevious();" onclick="loadNextPreviousVacncies(false)"></a>
            <h3 id="position" class="col-xs-8 job-title">${position}</h3>
            <a class="r-arrow fa fa-angle-right col-xs-2" href="javascript:loadNext();" onclick="loadNextPreviousVacncies(true)"></a>
                                    <h3 id="position" class="col-xs-8 job-title title-full-width">${position}</h3>

    JS code:
    function setNavigationButtons() {
    try {
        var areElementsOfParentAvailable = false;
      if(opener.document.getElementById("hdnTotalJobs") && opener.document.getElementById("hdnCurrentPage") 
            && opener.document.getElementById("hdnBlockSize") && opener.document.getElementById("selectdRow")) {
        areElementsOfParentAvailable = true;
      if(areElementsOfParentAvailable) {
          var totalJobs = parseInt(opener.document.getElementById("hdnTotalJobs").value);
          var curPage = parseInt(opener.document.getElementById("hdnCurrentPage").value);
          var currentRowID = document.getElementById("job-adview").getAttribute('data-rid');
          var rowIndex = parseInt(currentRowID)+1;
          var blockSize = 20;
          if(opener.document.getElementById("hdnBlockSize")) {
              blockSize = parseInt(opener.document.getElementById("hdnBlockSize").value);
          if(totalJobs>1) {
              var jobNo = (curPage-1)*blockSize+rowIndex;
              if (jobNo==1) {
                $('a.l-arrow').prop('disabled', true).css({'pointer-events': 'none'});
                $('a.r-arrow').prop('disabled', false).css({'pointer-events': 'auto'});
              } else if (jobNo==totalJobs) {
                $('a.l-arrow').prop('disabled', false).css({'pointer-events': 'auto'});
                $('a.r-arrow').prop('disabled', true).css({'pointer-events': 'none'});
              } else {
                $('a.l-arrow').prop('disabled', false).css({'pointer-events': 'auto'});
                $('a.r-arrow').prop('disabled', false).css({'pointer-events': 'auto'});
    } catch (error) {
        // An error is possible, for example, when attempting to access document of the parent window (opener) that opened this window, 
        // if this window was NOT opened by a JavaScript from another window. 
        // An example for when "opener" could be null is when standalone-AdView loads as result of a link-click in job-alert email. 
        // An example for when standalone-AdView is opened by a JavaScript is when it loads as result of a link click in list view of VBFA
        console.log('setNavigationButtons(): Error while setting up Next/Previous buttons: ' + error.name + '\n' + ' Error message: ' + error.message);
        $('a.l-arrow').prop('disabled', false);
        $('a.r-arrow').prop('disabled', false);

    Thursday, August 2, 2018 3:24 AM