I have a function that looks like this:
function reset_all_lightbox_assets()
{
$(document).one("click", function () {
$("#lightbox-asset-wrapdiv .category-asset-div-tileview").css({"background-color": "#f9f9f9"});
$("#lightbox-asset-wrapdiv .category-asset-table-td-category,#lightbox-asset-wrapdiv .category-asset-table-td-id").css("color", "#777777");
$("#lightbox-asset-wrapdiv .category-asset-table-td-name").css("color", "#999999");
});
}
When this function is called I want to be able to click the document once and execute the code.
The problem is that when the function is called, it also immediately detects the click. So how can I call the function so the click becomes enabled but only gets executed when I actually click again?
Call
event.stopPropagation()in the click handler that callsreset_all_lightbox_assets().