Converting string to number in javascript/jQuery

后端 未结 9 1878
攒了一身酷
攒了一身酷 2021-01-31 13:08

Been trying to convert the following to number:

9条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-31 13:47

    It sounds like this in your code is not referring to your .btn element. Try referencing it explicitly with a selector:

    var votevalue = parseInt($(".btn").data('votevalue'), 10);
    

    Also, don't forget the radix.

提交回复
热议问题