我在用 $(".button").on("click", function(){ });
单击一个容器上的按钮,然后ajax调用完成,内容更新新东西,然后当我尝试点击.button它不会工作...当我点击按钮时,什么都不会返回.
我甚至试过了
$(".button").live("click", function(){ });
Run Code Online (Sandbox Code Playgroud)
要么
$(".button").click(function(){ });
Run Code Online (Sandbox Code Playgroud)
我怎样才能使它工作?
编辑: 我的HTML:
<div class="container">
<ul>
<li>item1</li>
<li>item2</li>
<li>item3</li>
</ul>
<input type="button" value="reload" class="button" />
</div>
Run Code Online (Sandbox Code Playgroud) 每当我在服务器中使用SVN时,我就开始收到以下错误:
svn: warning: cannot set LC_CTYPE locale
svn: warning: environment variable LC_CTYPE is UTF-8
svn: warning: please check that your locale name is correct
Run Code Online (Sandbox Code Playgroud)
我的猜测是我的svn客户端(使用版本应用程序)和服务器svn可能有问题......
每当我使用这些命令时,如何让这个警告永远从服务器中消失?
我的数组看起来像这样:
array(
0 => 'val',
2 => 'val',
3 => 'val',
5 => 'val',
7 => 'val'
);
Run Code Online (Sandbox Code Playgroud)
如何重新排序按键以便它会像0, 1, 2, 3, 4?
我想将B int数组指针传递给func函数,并能够从那里更改它,然后查看main函数中的更改
#include <stdio.h>
int func(int *B[10]){
}
int main(void){
int *B[10];
func(&B);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
上面的代码给了我一些错误:
In function 'main':|
warning: passing argument 1 of 'func' from incompatible pointer type [enabled by default]|
note: expected 'int **' but argument is of type 'int * (*)[10]'|
Run Code Online (Sandbox Code Playgroud)
编辑:新代码:
#include <stdio.h>
int func(int *B){
*B[0] = 5;
}
int main(void){
int B[10] = {NULL};
printf("b[0] = %d\n\n", B[0]);
func(B);
printf("b[0] = %d\n\n", B[0]);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
现在我得到这些错误:
||In function 'func':|
|4|error: invalid type …Run Code Online (Sandbox Code Playgroud) 我有一个表单,我传递一个名为 的字段:type,我想检查它的值是否在允许类型数组内,以便不允许任何人发布不允许的类型.
数组看起来像
@allowed_types = [
'type1',
'type2',
'type3',
'type4',
'type5',
'type6',
'type7',
etc...
]
Run Code Online (Sandbox Code Playgroud)
我尝试使用 validates_exclusion_of或validates_inclusion_of但似乎没有用
我的SQL查询:
SELECT *
FROM updates_cats
WHERE uid =118697835834
ORDER BY created_date ASC
Run Code Online (Sandbox Code Playgroud)
目前指数:
index1(uid, created_date)
Run Code Online (Sandbox Code Playgroud)
EXPLAIN EXTENDED结果:
1 SIMPLE updates_cats ref index1 index1 8 const 2 100.00 Using where
Run Code Online (Sandbox Code Playgroud)
如何修复Extra字段使用哪里可以使用索引?
编辑:显示创建表:
CREATE TABLE `updates_cats` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`u_cat_id` bigint(20) NOT NULL DEFAULT '0',
`uid` bigint(20) NOT NULL,
`u_cat_name` text COLLATE utf8_unicode_ci NOT NULL,
`total_updates` int(11) unsigned NOT NULL DEFAULT '0',
`created_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`),
KEY `index1` (`uid`,`created_date`)
) ENGINE=MyISAM AUTO_INCREMENT=23522 …Run Code Online (Sandbox Code Playgroud) 我有以下HTML代码
<div class="text">bla bla bla bla</div>
<div class="button">Show</div>
Run Code Online (Sandbox Code Playgroud)
和CSS
.text{
height:100px;
overflow:hidden;
}
Run Code Online (Sandbox Code Playgroud)
假设.text div有更多文本,我所做的是隐藏100px以下的文本量.
我怎样才能slideDown()在div这样我就可以查看文本,当我点击按钮?
使用$(".button").slideDown();不起作用,因为我需要删除高度,然后slideDown()这也无法正常工作.
HTML:
<ul id="categories_list" class="ui-sortable">
<li class="cat_row" style=""> item1 </li>
<li class="cat_row" style=""> item2 </li>
<li class="cat_row"> item3 </li>
</ul>
Run Code Online (Sandbox Code Playgroud)
使用Javascript:
$("#categories_list").sortable({
placeholder: 'sortable_placeholder',
update : function () {
var order = $("#categories_list").sortable('serialize');
console.log(order);
}
});
Run Code Online (Sandbox Code Playgroud)
命令返回"空字符串"为什么会这样?
我想使用以下代码删除帖子:
<%= link_to 'Destroy', post, :method => :delete, :onclick => "return confirm('Are you sure you want to delete this post?')" %>
Run Code Online (Sandbox Code Playgroud)
这不起作用......它只是将我重新定向回帖子 (posts/:id}
但是,如果我使用以下代码,它的工作原理
<%= button_to 'Destroy', post, method: :delete, :onclick => "return confirm('Are you sure you want to delete this post?')" %>
Run Code Online (Sandbox Code Playgroud)
是否可以link_to像button_to这种情况一样表现?
编辑:破坏控制器功能
def destroy
@post = Post.find(params[:id])
@post.destroy
respond_to do |format|
format.html { redirect_to posts_url }
format.json { head :no_content }
end
end
Run Code Online (Sandbox Code Playgroud)
单击"销毁"按钮时记录:
Started GET "/posts/14" for 127.0.0.1 at 2012-10-21 15:38:28 +0300 …Run Code Online (Sandbox Code Playgroud) 由于我在共享主机上,我想添加一个图像托管脚本,似乎用755它不允许我上传图像,所以我将文件夹更改为757,chmod到757是否安全?