What would be the easiest way with regex to extract the href string containing a stylesheet link and save it to a variable in JavaScript?
The stylesheet is a string and not a real stylesheet link. It's intended to be inserted with Javascript after the page loads.
EDIT:
<script>
// Loading stylesheet just before body closes
$(function() {
var stylesheet = '<link href="/Static/css/compiled/styles.css" rel="stylesheet"/>';
var stylesheetHref = ""; // WANT TO SET THIS!!
if (document.createStyleSheet) {
document.createStyleSheet(stylesheetHref);
} else {
$("head").append(stylesheet));
}
});
</script>
getAttribute()method?