bind.js 451 B

12345678910111213141516171819
  1. $(document).on('click', '[data-wizard]', function(e){
  2. var href;
  3. var $this = $(this);
  4. var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, ''));
  5. var wizard = $target.data('wizard');
  6. if(!wizard){
  7. return;
  8. }
  9. var method = $this.data('wizard');
  10. if(/^(back|next|first|finish|reset)$/.test(method)){
  11. wizard[method]();
  12. }
  13. e.preventDefault();
  14. });