Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/452.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript jQuery看不到添加的文本_Javascript_Jquery - Fatal编程技术网

Javascript jQuery看不到添加的文本

Javascript jQuery看不到添加的文本,javascript,jquery,Javascript,Jquery,有一个脚本。它将选择中的文本添加到特殊价格块的标记中。在输入number时,添加新的类似块。必须添加与上一块完全相同的块。但是标签(numb,curr)中的文本没有添加。我知道这个脚本只解析原始的HTML标记 守则: (函数(){ $(文档).ready(函数(){ $('.field.inline.specialize>span.curr').text( $('#id_lot_currency>option:selected').eq(0).text() ); $('.field.inli

有一个脚本。它将
选择
中的文本添加到
特殊价格
块的标记中。在输入
number
时,添加新的类似块。必须添加与上一块完全相同的块。但是标签
numb
curr
)中的文本没有添加。我知道这个脚本只解析原始的HTML标记

守则:

(函数(){
$(文档).ready(函数(){
$('.field.inline.specialize>span.curr').text(
$('#id_lot_currency>option:selected').eq(0).text()
);
$('.field.inline.specialize>span.numb').text(
$('#id_lot_type>option:selected').eq(0).text()
);
$(文档).on('change','id\u lot\u currency',函数(){
$('.field.inline.span').eq(3).text($('option:selected',this).text())
})
$(文档).on('change','id\u lot\u type',函数(){
$('.field.inline.span').eq(1).text($('option:selected',this).text())
});
})
var copy=document.querySelector('.field.inline.specialized').cloneNode(true);
document.querySelector('html')。addEventListener('input',function(e){
if(e.target.classList.contains('event')&&e.target.tagName=='INPUT'){
var误差=0;
for(document.querySelectorAll('.field.inline.input.event')的var evt){
evt.value=evt.value.replace(/[^\d]/,“”);
如果(!evt.value | |+evt.value<1)错误++;
}
如果(!错误){
var last=document.querySelectorAll('.field.inline.specialized');
last[last.length-1].insertAdjacentHTML('afterEnd',copy.outerHTML);
}
}
});
})();

最低批数:
公斤
脚
费用:
美元
blg
乌阿
特价
而不是
$('item')。在('change',function)
上使用
$(document)。在('change','item',function)
上,它将处理注入的HTML事件。

(函数(){
$(文档).ready(函数(){
$('.field.inline.specialize>span.curr').text(
$('#id_lot_currency>option:selected').eq(0).text()
);
$('.field.inline.specialize>span.numb').text(
$('#id_lot_type>option:selected').eq(0).text()
);
$(文档).on('change','id\u lot\u currency',函数(){
$('.field.inline.span.curr').text($('option:selected',this.text())
})
$(文档).on('change','id\u lot\u type',函数(){
$('.field.inline.span.numb').text($('option:selected',this.text())
});
})
document.querySelector('html')。addEventListener('input',function(e){
var copy=document.querySelector('.field.inline.specialized').cloneNode(true);
if(e.target.classList.contains('event')&&e.target.tagName=='INPUT'){
var误差=0;
for(document.querySelectorAll('.field.inline.input.event')的var evt){
evt.value=evt.value.replace(/[^\d]/,“”);
如果(!evt.value | |+evt.value<1)错误++;
}
如果(!错误){
var last=document.querySelectorAll('.field.inline.specialized');
last[last.length-1].insertAdjacentHTML('afterEnd',copy.outerHTML);
}
}
});
})();

最低批数:
公斤
脚
费用:
美元
blg
乌阿
特价

thnx,但它不起作用。文本未添加到
span curr
span numb
(在副本块中)。更新了中的和中的代码。