Have a jquery where "displayInput" display some hidden input controls, and by clicking outside or pressing enter or escape, back to it hidden state..
.bind and .mouseup only work as soon I run displayInputs, that's ok.. the problem is both still fire to the console.log and I cant find a way to stop them.
function displayInputs(ID){
//Show Inputs
$(document).bind('keypress', function(e){
if (e.which == 13 || e.keyCode == 27){ // escape or enter key
//Hide Inputs
console.log('still alive');
return false;
}
});
// Outside click action
$(document).mouseup(function(e){
//Hide Inputs
console.log('still alive');
return false;
}
}
Working JSFiddle
$(document).off(); seems it works but kill other scripts..
question from:
https://stackoverflow.com/questions/65939113/stop-jquery-function-from-bind-and-mouseup 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…