utils.js 649 B

1234567891011121314151617181920212223
  1. /**
  2. *
  3. * Created by James on 15/11/29.
  4. */
  5. function insert_warning_window(element, content) {
  6. // 展出警告框
  7. element.before(
  8. '<div class="alert alert-warning alert-dismissible fade in" role="alert">' +
  9. '<button id="warning_window_close_btn" type="button" class="close" data-dismiss="alert" aria-label="Close">' +
  10. '<span aria-hidden="true">&times;</span>' +
  11. '</button>' +
  12. content +
  13. '</div>');
  14. // 3秒后自动关闭
  15. setTimeout(function() {
  16. $('#warning_window_close_btn').click();
  17. }, 3000);
  18. }
  19. $.fn.hasAttr = function(name) {
  20. return this.attr(name) !== undefined;
  21. };