- 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(); });
My intention is to avoid checking the following all the time: if (!$("#collapseReviewerHistory").hasClass("show"))....
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"))....