Converting string to number in javascript/jQuery

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

Been trying to convert the following to number:

9条回答
  •  梦毁少年i
    2021-01-31 13:52

    You can use parseInt(string, radix) to convert string value to integer like this code below

    var votevalue = parseInt($('button').data('votevalue'));
    ​
    

    DEMO

提交回复
热议问题