作者:庾承泓_689 | 来源:互联网 | 2023-01-29 09:47
TheproblemIhaverightnowisthatwhenIputthedocument.readycodewrappingmyscriptitstopps
The problem I have right now is that when I put the document.ready code wrapping my script it stopps working. I know I can simply not use it, because I only call the script in the end of my HTML, but I want to know why it is breaking my code. PS: I have already added jQuery Code:
我现在遇到的问题是,当我把document.ready代码包装到我的脚本时,它会停止工作。我知道我不能使用它,因为我只在HTML的末尾调用脚本,但我想知道为什么它会破坏我的代码。 PS:我已经添加了jQuery代码:
$(document).ready(function () {
$('.clicker').click(function() {
if($(this).hasClass('clicker'))
{
var row_index = $(this).parents('tr').index();
$(this).text('Cancelar');
$(this).attr('class', 'cancelar');
var index = row_index - 2;
$(".save:eq("+index+")").css('display', 'inline');
}
else
{
$(this).text('Editar');
$(this).attr('class', 'clicker');
$('.save').css('display', 'none');
}
});
});
//In the end of the html file:
1 个解决方案