Answers for "get number from string using jquery"

0

jquery extract number from string

var id_of_div = "div_id_12";
var id_number = parseInt(id_of_div.replace(/[^0-9.]/g, ""));
console.log(id_number);//12
Posted by: Guest on July-15-2020
0

get number from string using jquery

You can get it like this:

var suffix = 'comment_like_123456'.match(/\d+/); // 123456

With respect to button:

$('.comment_like').click(function(){
  var suffix = this.id.match(/\d+/); // 123456
});

It works for me.
Posted by: Guest on March-03-2021

Code answers related to "get number from string using jquery"

Code answers related to "Javascript"

Browse Popular Code Answers by Language