Jquery 每个命令都不起作用
我希望以下代码在我的joomla网站中的一个paegs中运行。这段代码只是在用户单击第四列时打开一个表单,该列包含相关的名字和。。。。我直接在phpmyAdmin中将此代码添加到joomla文章HTML的末尾,这样js代码就不会被过滤Jquery 每个命令都不起作用,jquery,Jquery,我希望以下代码在我的joomla网站中的一个paegs中运行。这段代码只是在用户单击第四列时打开一个表单,该列包含相关的名字和。。。。我直接在phpmyAdmin中将此代码添加到joomla文章HTML的末尾,这样js代码就不会被过滤 jQuery(document).ready(function ($) { jQuery(".oldPeople tr:not(.oldPeople tr:first)").each(function (i) { //code
jQuery(document).ready(function ($) {
jQuery(".oldPeople tr:not(.oldPeople tr:first)").each(function (i) {
//code
jQuery(this td:nth-child(4)).css('cursor', 'pointer');
jQuery(this td:nth-child(4)).click(function () {
var fname = jQuery(this td: nth - child(1)).html();
var lname = jQuery(this td: nth - child(2)).html();
var dep = jQuery(this td: nth - child(3)).html();
var str = encodeURI("http://alumsharif.org/index.php?option=com_rsform&formId=38&form[fname]=" + fname + "&form[lname]=" + lname + "&form[dep]="dep);
jQuery(this td:nth-child(4)).replaceWith(str);
window.open(str);
}); //click
}); //each
}); //ready
网页为:
但是代码不起作用。。当我把console.log放在每个函数中时,什么都没有发生。。。我不知道我是否遗漏了某个内容…很抱歉,我的代码中出现了愚蠢的基本错误: 我更正了我的代码并发布了它,以防有人需要它
jQuery(document).ready(function($) {
jQuery(".oldPeople tr:not(.oldPeople tr:first)").each(function(i) {
//code
var tr = jQuery(this);
jQuery(this).children("td:nth-child(4)").css( 'cursor', 'pointer' );
jQuery(this).children("td:nth-child(4)").click(function(){
var fname = tr.children("td:nth-child(1)").text();
console.log(fname);
var lname = tr.children("td:nth-child(2)").text();
var dep = tr.children("td:nth-child(3)").text();
var str = "http://alumsharif.org/index.php?option=com_rsform&formId=38&form[fname]="+encodeURI(fname)+"&form[lname]="+encodeURI(lname)+"&form[dep]="+encodeURI(dep);
//jQuery(this).children("td:nth-child(4)").replaceWith(str);
window.open(str,' ارسال اطلاعات' + fname + " " +lname, 'width=600, height=600');
console.log(str);
});//click
});//each
});//ready
Uncaught SyntaxError:missing)在参数列表之后(我找不到任何缺少的内容),因为缺少的是一个+
:..+“&form[dep]=”dep)代码>->..+”&格式[dep]=“+dep)
和jQuery中的“选择器”(这个td:n子项(4))
也是错误的abt选择器出了什么问题?