One of the ways of adding data to your markup that can be quite useful is being able to grab database information such as ids from classes. Here is a generic function for doing this (I can’t find a way to get pre blocks working on here, which makes this look messy…):
function getNumberFromClassName(el, prefix) {
var regexp = new RegExp(prefix + ‘(\\d+)’),
matches = el.className.match(regexp),
result = (matches1) ? matches1 : false;
return result;
}
One of the ways of adding data to your markup that can be quite useful is being able to grab database information such as ids from classes. Here is a generic function for doing this (I can’t find a way to get pre blocks working on here, which makes this look messy…):
Markup:
Call the function:
Hope this is useful to someone… sorry textile bc. codeblocks do not work here…