Created
July 2, 2014 05:28
-
-
Save edele/5ef247a0d4875b936ebe to your computer and use it in GitHub Desktop.
Единый обработчик кликов
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
| // кликабельному элементу ставится класс 'clickable' | |
| // и класс, описывающий действие 'btn-open-popup-form' или 'btn-submit' | |
| $(document).ready(function() { | |
| $(".clickable").on("click", function() { | |
| if ( $(this).hasClass("btn-open-popup-form") ) | |
| $("#popup-form").show(); | |
| if ( $(this).hasClass("btn-popup-submit") ) | |
| $("#form").submit(); | |
| // тут показываем ошибку в консоли | |
| console.log( $(this) ); | |
| console.log('На кнопку не назначен обработчик'); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment