简体   繁体   English

js中的appendTo()函数不起作用

[英]The appendTo() function in js didn't work

I met a problem with js. 我遇到了js问题。 The js function appendTo() is not work! js函数appendTo()不起作用! my js code is like this: 我的js代码是这样的: 在此处输入图片说明

my browser console shows that everythings is as planed: 我的浏览器控制台显示一切都按计划进行: 在此处输入图片说明

here is the problem , my html element tbody doesn't contain any things as followed: 这是问题所在,我的html元素tbody不包含任何如下内容: 在此处输入图片说明

why? 为什么? how can i fix this? 我怎样才能解决这个问题?

Although HTML id is allowed to contain dot and colon characters, the fact that you are using jQuery makes it doesn't work because dot and colon have special meaning in aa selector context. 尽管HTML id允许包含点和冒号字符,但是您使用jQuery的事实使其无法使用,因为点和冒号在选择器上下文中具有特殊含义。

The following native JS will work: 以下本机JS将起作用:

document.getElementById('tb_10.3.3.186:32222').innerHTML += html;

But if you still want to use jQuery, you need to remove the dot ( . ) and colon ( : ) from your id . 但是,如果你仍然想使用jQuery,你需要删除的点( .和结肠癌)( :从你的) id

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM