简体   繁体   English

当目标由cms系统自动生成的类时,append失败

[英]append fails when target a class auto-generated by cms system

I need help on the following. 我需要以下方面的帮助。

The only way to solve this is be able to target the class. 解决这个问题的唯一方法是能够定位该类。 else what i am trying will not work. 否则我正在尝试的将无法工作。 (I need to append some buttons behind the input field) The cms system generate the code for the input class itself. (我需要在输入字段后面添加一些按钮)cms系统为输入类本身生成代码。 (apparently added on load screen) somehow there is now way i can target this with jquery…? (显然在加载屏幕上添加)不知何故现在我可以用jquery来定位这个...? or i just miss some skill be able to do so? 或者我只是想念一些技能能够做到这一点?

my jquery code: 我的jquery代码:

$(".theInput").append($addButtons);

when i change .theInput with a other class , all working, but . 当我改变.theInput与另一个班级 ,所有工作,但。 theInput is just not WORKING. 输入只是没有工作。

NEED HELP 需要帮忙

auto-generated by the cms system where i have totally no control to adjust it. 由cms系统自动生成,我完全无法控制它。

<td class="system">
<div class="cell">
<input onchange="some long code" class="theInput" type="text" value="1" /></div>

<div class="cell">
<input onchange="some long code" class="theInput" type="text" value="1" /></div>

<div class="cell">
<input onchange="some long code" class="theInput" type="text" value="1" /></div>

and so on. 
</td>

Have you wrapped the code in a 你有没有把代码包装成一个

$(document).ready(function(){$(".theInput").append($addButtons);
});

You have to wait for the Dom to be loaded until you can target elements 您必须等待Dom加载,直到您可以定位元素

I'm not exactly sure what you mean by "behind the inputs", but you can't really append something to an input. 我不完全确定“输入后面”是什么意思,但你不能真正地将某些东西添加到输入中。 Append adds the element inside, and there is no inside for an input. Append将元素添加到内部,并且没有内部输入。 If you want to add something after the input you could do: 如果您想在输入后添加内容,您可以执行以下操作:

$(".theInput").after($addButtons);

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

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