jQuery > Snippet .1
by s_hiroshi
HTML
<p id="foo-1">Foo1</p>
JavaScript
function getIdNo(elem) {
return $(elem).attr('id').split('-')[1];
}
console.log(getIdNo($('#foo-1')[0]));
by s_hiroshi
<p id="foo-1">Foo1</p>
function getIdNo(elem) {
return $(elem).attr('id').split('-')[1];
}
console.log(getIdNo($('#foo-1')[0]));