How do you exit from an event?
$('.more').click(function() {
if (condition1) {
if (condition2) {
// abort, exit completely out of click handler
...
How do you exit from an event?
$('.more').click(function() {
if (condition1) {
if (condition2) {
// abort, exit completely out of click handler
...
Use the return there:
$('.more').click(function() {
if (condition1) {
if (condition2) {
// abort, exit completely out of click handler
return;
See:
return;
That will take you out of the function that is associated with the on click handler;
Note that you can also use break here.
$('.more').click(function() {
if (condition1) {
if (condition2) {
// abort, exit completely out of click handler
break;