我如何()使用多输入函数和带有varibele更改的id [英] How do I for() function with multi input and the id with a varibele change

查看:47
本文介绍了我如何()使用多输入函数和带有varibele更改的id的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

for(i=0; i<singels.length ; i++){




var count = i+'"';
var $singel = '"#singel';



$($singel+count).on('change', function() {
var val = $($singel+count).val();
var someSingel = val*singelsvalue;
$("span").text(someSingel.toFixed(2));
someSingel = someSingel * val;
});


$("#box #singels form ul").append("<li>"
+ singels[i] + " " + singelsvalue[i]+ "          " +
'<input class="input" id="singel'+i+'" name="singel'+i+'" type="text" placeholder="stake "><p>To Return  <span>'+ someSingel +'<span></p></li>');
}





我的尝试:


和所有循环需要.append in form-> ul->新的li与id =singel+ [i]

它的工作正常,但只是在anoteh线工作的我有一些问题

i有一些数组有这个数组所有循环推送ID中的项目

和dann我需要精确地输入另一个id wehen用户输入char代码

.keyup()取char并输入类似输入 - > 250

输入* val(//来自阵列的这个val,即[3])= 750

现在我需要我做的工作

cosdole给我错误



What I have tried:

in this code i need using loop for
and all loop need .append in form->ul-> new li with id="singel"+[i]
its work fine but just the li working in anoteh line i havs a some problem
i have some array with this array all loop push the item in id
and dann i need finely all input with another id wehen user input char the code
.keyup() take the char and make like input->250
input * val(//this val from a array i.e [3])=750
now i need now what i make worng
cosdole give me error "

Uncaught Error: Syntax error, unrecognized expression: 

推荐答案

singel ='#singel';
singel = '"#singel';



singel + count).on('change',function(){
var val =
singel+count).on('change', function() { var val =


这篇关于我如何()使用多输入函数和带有varibele更改的id的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆