Created
June 4, 2013 19:22
-
-
Save jtallant/5708718 to your computer and use it in GitHub Desktop.
How can I remove the duplication and do something like document.on(click, selector1, selector2, function() { // some code here });
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('.reward-sections ul li a').click(function() { | |
var type = $(this).data('type'); | |
if ('link' === type || 'coming_soon' === type) { | |
return true; | |
} | |
var reward_data = { | |
'reward_id': $(this).data('reward-id'), | |
'status': $(this).data('status'), | |
'type': type | |
}; | |
showRewardModal(reward_data); | |
}); | |
$(document).on('click', '.resource-content li a', function(){ | |
var type = $(this).data('type'); | |
if ('link' === type || 'coming_soon' === type) { | |
return true; | |
} | |
var reward_data = { | |
'reward_id': $(this).data('reward-id'), | |
'status': $(this).data('status'), | |
'type': type | |
}; | |
showRewardModal(reward_data); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What about something like this?