donglu5000 2017-01-06 07:00
浏览 55
已采纳

输入类型范围输出不适用于动态ID

Input type range functionality is not working when the id values are dynamic how can i do that..?

<input name="gdOverallscore" id="gdOverallscore" type="range" min="0" value="0" max="10" step="1" list="ticks" oninput="ageOutputId.value = gdOverallscore.value"/><output id="ageOutputId">0</output>

<h2>This is working fine in my case i have dynamic id which is loop"</h2>
<br>
<input  name="gdskill[<?php echo  $skillLabel['ssid'];?>]"
       id="gdskill[<?php echo  $skillLabel['ssid'];?>]" 
       type="range"
       min="0" value="0" max="10" step="1" 
       list="ticks" 
       oninput="Output.value = gdskill[<?php echo  $skillLabel['ssid'];?>].value"/>
<output id="Output">0</output>

<br>
<h2>
In the second one id values comes like this:
gdskill[1],gdskill[3],gdskill[4],gdskill[6] etc..

</h2>

</div>
  • 写回答

2条回答 默认 最新

  • doucheng1891 2017-01-06 08:54
    关注

    You have to change your Ouptut Id as well or else the output will become same for all hence it wont work..

    <input name="[]" id="gdskill<?php echo  $skillLabel['ssid'];?>"
    
     type="range" min="0" value="0" max="10" step="1"
    
    oninput="Output<?php echo  $skillLabel['ssid'];?>.value = gdskill<?php echo  $skillLabel['ssid'];?>.value"/>
    
    <output id="Output<?php echo  $skillLabel['ssid'];?>">0</output>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容
  • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题