javascript - JQuery extract a number from an array of href -


i have page links like:

<a class="mod-articles-category-title " href="curso-bsc/82-balanced-scorecard/o-bsc-uma-ferramenta-para-melhorar-a-performance-da-organizacao/377-responsabilizacao-e-trabalho-de-equipa">  <a class="mod-articles-category-title " href="curso-bsc/82-balanced-scorecard/o-bsc-uma-ferramenta-para-melhorar-a-performance-da-organizacao/378-recompensas-e-incentivos-baseados-no-bsc">  <a class="mod-articles-category-title " href="curso-bsc/82-balanced-scorecard/o-bsc-uma-ferramenta-para-melhorar-a-performance-da-organizacao/99-vantagens-do-bsc-gestao-da-mudanca"> 

i need array numbers after last slash (/) , following minus (-):

"377", "378", "99"

i'm using:

links=$('.mod-articles-category-title').attr('href'); 

but i'm missing expression numbers array. can help?

var links = []; $('a.mod-articles-category-title').each(function () {     links.push($(this).attr('href').match(/(\d+)/g)[1]); }); console.log(links); 

jsfiddle example


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -