bootstrap 操作提示placeholder
Javascript 部分
function checkForDefaultAlertPlaceholder() {
if ($("#alertPlaceholder").length == 0) {
$("body > div:nth-child(2)").prepend($('<div id="alertPlaceholder"></div>'));
}
}
bootstrap_alert = function () { }
bootstrap_alert.danger = function (message, timeout, idContainer) {
if (idContainer == null) {
checkForDefaultAlertPlaceholder();
}
var $alert = $('<div class="alert alert-danger alert-dismissable fade in" role="alertdialog"><strong>Error:</strong> ' + message + '<button type="button" class="close" data-dismiss="alert" aria-hidden="true"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button></div>');
$("#" + (idContainer != null ? idContainer : "alertPlaceholder")).append($alert);
if (timeout != null && timeout > 0) {
setTimeout(function () {
$alert.alert("close");
}, timeout);
}
return $alert;
}
bootstrap_alert.warning = function (message, timeout, idContainer) {
if (idContainer == null) {
checkForDefaultAlertPlaceholder();
}
var $alert = $('<div class="alert alert-warning alert-dismissable fade in" role="alertdialog">' + message + '<button type="button" class="close" data-dismiss="alert" aria-hidden="true"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button></div>');
$("#" + (idContainer != null ? idContainer : "alertPlaceholder")).append($alert);
if (timeout != null && timeout > 0) {
setTimeout(function () {
$alert.alert("close");
}, timeout);
}
return $alert;
}
bootstrap_alert.success = function (message, timeout, idContainer) {
if (idContainer == null) {
checkForDefaultAlertPlaceholder();
}
var $alert = $('<div class="alert alert-success alert-dismissable fade in" role="alertdialog"><strong>Success:</strong> ' + message + '<button type="button" class="close" data-dismiss="alert" aria-hidden="true"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button></div>');
$("#" + (idContainer != null ? idContainer : "alertPlaceholder")).append($alert);
if (timeout != null && timeout > 0) {
setTimeout(function () {
$alert.alert("close");
}, timeout);
}
return $alert;
}
将DIV加在表头某处:
<div id="alertPlaceholder"></div>
Ajax调用代码区:
$('#').click(function(){
$.ajax({
type:'POST',
url:<link>,
data:{},
success:function(data){
bootstrap_alert.success("The data has been saved.", 1000);
},
error:function(data){
bootstrap_alert.danger("Exception!This operation is not performed successfully! Please contact admin!", 1000);
}
});
});
bootstrap 操作提示placeholder的更多相关文章
- 小技巧:SystemTray中进行操作提示
SystemTray中进行操作提示在wp中应用比较广泛,截图如下. 实现方法也十分简单 1.xaml代码中写入: shell:SystemTray.IsVisible="True" ...
- AIX-vi操作-提示Unknown terminal type的问题解决方法
AIX-vi操作-提示Unknown terminal type的问题解决方法AIX Version 5.3$ vi /etc/profilelinux: Unknown terminal type[ ...
- Bootstrap -- 插件: 提示工具、弹出框、 警告框消息
Bootstrap -- 插件: 提示工具.弹出框. 警告框消息 1. 提示工具(Tooltip)插件:根据需求生成内容和标记. 使用提示工具: <!DOCTYPE html> <h ...
- wp8.1 app退出操作提示
微软的wp8.1 sdk相比之前wp8 sdk以及相关dll类库,微软又重新编译过,相关系统类库也经过精简,删改了部分传统dll库中的方法对象,很多常用方法对象被写进Windows.UI为前缀的命名空 ...
- eclipse的hadoop插件对集群操作提示org.apache.hadoop.security.AccessControlException:Permission denied
eclipse的hadoop插件对集群操作提示org.apache.hadoop.security.AccessControlException:Permission denied: user = z ...
- Android使用ShowcaseView加入半透明操作提示图片的方法
http://beeder.me/2014/11/11/how-to-add-a-semi-transparent-demo-screen-using-showcaseview/ 这篇文章具体介绍了如 ...
- flutter Tooltip轻量级操作提示
Tooltip是继承于StatefulWidget的一个Widget,它并不需要调出方法,当用户长按被Tooltip包裹的Widget时,会自动弹出相应的操作提示. import 'package:f ...
- 数据库操作提示:Specified key was too long; max key length is 767 bytes
操作重现: 法1:新建连接——>新建数据库——>右键数据库导入脚本——>提示:Specified key was too long; max key length is 767 by ...
- HTML5表单提示placeholder属性兼容IE
placeholder 属性提供可描述输入字段预期值的提示信息(hint). 该提示会在输入字段为空时显示,并会在字段获得焦点时消失. 注释:placeholder 属性适用于以下的 <inpu ...
随机推荐
- django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE的解决办法(转)
在python的开发中,遇到了这个错误: django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TA ...
- SSD(Single Shot MultiBox Detector)二读paper
SSD KeyWords:Real-time Object Detection; Convolutional Neural Network Introduction 目前最尖端(State-of-ar ...
- ionic学习笔记—常用命令
Ionic CLI介绍 Ionic CLI是开发Ionic应用程序过程中使用的主要工具.它就像一个瑞士军刀:它在一个界面下汇集了大量工具. CLI包含许多对Ionic开发至关重要的命令,例如start ...
- Android MVP Presenter 中引发的空指针异常
一.概述 最近对 googlesamples/android-architecture 中的 MVP-dagger 进行了学习.对照项目的 MVP-dagger 分支,对 MVP-dagger 进行了 ...
- PAT 天梯赛 L1-045. 宇宙无敌大招呼 【水】
题目链接 https://www.patest.cn/contests/gplt/L1-045 AC代码 #include <iostream> #include <cstdio&g ...
- HDOJ 1423 Greatest Common Increasing Subsequence 【DP】【最长公共上升子序列】
HDOJ 1423 Greatest Common Increasing Subsequence [DP][最长公共上升子序列] Time Limit: 2000/1000 MS (Java/Othe ...
- logback logback.xml 常用配置详解(转)
本文转自:http://my.oschina.net/looly/blog/298675 推荐参考:http://blog.csdn.net/haidage/article/details/67945 ...
- JS 原生JS 判断滚动条滑动到底部
window.addEventListener("scroll", function(event) { var scrollTop = document.documentEleme ...
- SpringBoot RedisMQ消息队列与发布订阅
SpringBoot简单整合RedisMQ消息队列和发布订阅 注:RedisMq消息队列使用redis数组实现,leftpush存一,rightpop取一. 1.application.propert ...
- Linux 进程管理 进程优先级管理
Linux进程优先级 Linux 是一个多用户.多任务的操作系统,系统中通常运行着非常多的进程.但是 CPU 在一个时钟周期内只能运算一条指令(现在的 CPU 采用了多线程.多核心技术,所以在一个时钟 ...