我使用下面的代码已删除图像但缩略图仍然显示.
Dropzone.options.myDropzone = {
init: function() {
this.on("success", function(file, response) {
file.serverId = response;
});
this.on("removedfile", function(file) {
if (!file.serverId) { return; }
$.post("delete-file.php?id=" + file.serverId);
});
}
Run Code Online (Sandbox Code Playgroud) 我试图在单击按钮时关闭颜色框窗口.窗口应该是一个ajax分页窗口.
我已经尝试过示例页面,内联按钮可以关闭,我在ajax分页中写的相同代码,但它在控制台firebug中抛出错误,即
**"TypeError: $.colorbox is undefined
(9 out of range 6)"**
Run Code Online (Sandbox Code Playgroud)
我真的不知道错误的含义.
我的HTML代码是.index.html
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'/>
<title>Colorbox Examples</title>
<style>
body {
font:12px/1.2 Verdana, sans-serif;
padding:0 10px;
}
a:link, a:visited {
text-decoration:none;
color:#416CE5;
border-bottom:1px solid #416CE5;
}
h2 {
font-size:13px;
margin:15px 0 0 0;
}
</style>
<link rel="stylesheet" href="colorbox.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="../jquery.colorbox.js"></script>
<script>
$(document).ready(function(){
$(".ajax").colorbox();
$(".inline").colorbox({inline:true, width:"50%"});
$('#test_close').click('cbox_closed',function(e){
$('#test_close').colorbox.close();
});
});
</script>
</head>
<body>
<p><a class='ajax' href="http://localhost/karthiga/demo/colorbox-master/content/ajax.html" title="Homer Defined">Outside HTML (Ajax)</a></p>
<p><a class='inline' href="#inline_content">Inline HTML</a></p>
<!-- …Run Code Online (Sandbox Code Playgroud) 我的格式中有一个价格字段,我应该只允许小数或浮点数,而不是我的价格字段中的字符和任何其他特殊和空格.
我怎么能得到那个?
这是我的代码:
$("#foo").blur(function() {
var price = $("#foo").value;
var validatePrice = function(price) {
return /^(\d*([.,](?=\d{3}))?\d+)+((?!\2)[.,]\d\d)?$/.test(price);
}
alert(validatePrice(price)); // False
});
Run Code Online (Sandbox Code Playgroud)
我有一个字符串
$string =19,17,1,2,19,17;
Run Code Online (Sandbox Code Playgroud)
这里19和17发生了两次,我怎么能消除发生的事情,它应该会发生
$string =19,17,1,2;
Run Code Online (Sandbox Code Playgroud)
我已经尝试过将字符串转换为数组并使用in_array检查数组;但我知道如何生成结果;
$id = explode(',',$string );
$a=array();
foreach($id as $k){
if (!in_array($string , $id))
$a[]=$k;
}
Run Code Online (Sandbox Code Playgroud)