dsf4s5787 2017-01-25 04:36
浏览 174
已采纳

如何获取nodes [i] .dataset.key的值

I have variable called Votes. And its looped like a list view.I want to update a specific raw item value of this varible.For that I use raw number here hard coded 765, and managed to get in. How can i get the value nodes[i].dataset.key and increment it

eg: My raw id 765 --> $varible value is 30 --> make it 31

    if (nodes[i].dataset.key == 765){
       // i want to go inside using raw ID and update the value display on that raw 
        }

Requirement:

I have varibale numVotes in a loop with values. In raw 765 i want to update that value. I already figured to find the exact raw now how to update the varibale value in that raw?

Update:

<td align="center" colspan="5" class="num_votes" data-key="<?php echo $rawID ?>"><?php echo $votes ?></td>

This is what i'm targeting. this is inside a raw.Now if this is raw 765 i want to update the vale $votes of that particular raw !

  • 写回答

1条回答 默认 最新

  • dongtu7567 2017-01-25 04:45
    关注

    Get the text content, parse the value, add 1 with the parsed value and re-assign the value.

    nodes[i].textContent = Number(nodes[i].textContent) + 1;
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)