如果我有这个滑块的输入必须有一个数组作为 id tag ,我如何在我初始化和构建滑块的脚本上调用标签?如果输入不是数组,则此代码有效,但我需要“数量”是数组。
/////////////////////SLIDER !!!!!!!!!!!!!!!!!!!!!!!!!!!
< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
< script>
var valueslider= "<?= $AnswerValue ?>";
var mysliderdef= valueslider.split(";");
var len = mysliderdef.length-1;
var i =0;
var qid="<?= $QuestionID ?>";
var answerid="<?= $AnswerID?>";
**$( "#amount"+qid).**val( mysliderdef[0]);//<-My tag name problem
$( "#slider" ).slider({
min: 1,
max: mysliderdef.length,
slide: function( event, ui ) {
**$( "#amount"+qid).**val( mysliderdef[ui.value-1]); //<- My tag name problem
}//end slide event
});//end slider ini method builder
});// end JavaScript document function
< /script>
<!--SLIDER-->
<?php if($row_questionset['Constructor']=="Slider"){?>
< input type="text" id="amount< ?= $row_Answer['QuestionIDFK'];?>[]" name="amount[]" />
< div id="slider" name="<?php echo $row_Answer['AnswerValue']; ?>" >< /div>
<?php } ?>
<?php } ?>
<!--/SLIDER-->
我试过了
$( "#amount"+qid+[]).val( mysliderdef[ui.value-1]);
$( "#amount"+qid[]).val( mysliderdef[ui.value-1]);
var qid="<?= $QuestionID ?>"[];
$( "#amount"+qid).val( mysliderdef[ui.value-1]);
我该如何编写这种语法?