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

Joined
Oct 24, 2013
Messages
47
Reaction score
0
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(); });
HTML:
<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>

JavaScript:
$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"))....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,701
Latest member
XavierQ83

Latest Threads

Top