Created
October 21, 2019 09:31
-
-
Save hh2k/da648e2fa43f6e9a17d5e290472bbe7c to your computer and use it in GitHub Desktop.
Loop button classes and set onclick from href
This file contains hidden or 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
| $('.button').each(function() { | |
| var link = $(this).find('a'); | |
| if (typeof link.prop('href') != 'undefined') { | |
| $(this).on('click', function() { | |
| location.href = link.prop('href'); | |
| }); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment