How can I assign to btnReviewerHistory like $newReviewerModal.on('hidden.bs.modal', function (e) { resetModal(); });

I have 2 states/DOM HTML for $btnReviewerHistory. I want to assign function btnReviewerHistory(ownerID) when btnReviewerHistory has only “btn” class like the way it is in the example below: $newReviewerModal.on(‘hidden.bs.modal’, function (e) { resetModal(); });

I have done it using the following but looking for a syntax like $newReviewerModal.on(‘hidden.bs.modal’, function (e) { resetModal(); });



<button id="btnReviewerHistory" class="btn" type="button" data-toggle="collapse" data-target="#collapseReviewerHistory" aria-expanded="true" aria-controls="collapseReviewerHistory">
    <i class="fa blue-text fa-minus-square"></i> Reviewer History
</button>

<button id="btnReviewerHistory" class="btn collapsed" type="button" data-toggle="collapse" data-target="#collapseReviewerHistory" aria-expanded="false" aria-controls="collapseReviewerHistory">
    <i class="fa blue-text fa-plus-square"></i> Reviewer History
</button>



$btnReviewerHistory.off("click").on("click", function () { return btnReviewerHistory(ownerID); });

function btnReviewerHistory(ownerID)
        {
          try
          {
            if (!$("#collapseReviewerHistory").hasClass("show"))
            {
              if(!$("#tblReviewerHistory").length) {
                loadReviewerHistoryReport(ownerID);
              }               
            }
          }
          catch (ex)
          {
            alert("Error in btnReviewerHistory(): " + ex);
            disableAll();
          }
        }
        
        
$newReviewerModal.on('hidden.bs.modal', function (e) { resetModal(); });

My intention is to avoid checking the following all the time: if (!$(“#collapseReviewerHistory”).hasClass(“show”))…

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.