The problem
I'm trying to get the content within the style tags but I can't get it to work.
What the code does
I use jQuery and try to get the style content with text() and html(). It does not work.
My code
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet/less" type="text/css" href="css/style.less">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js" type="text/javascript"></script>
<style id="less:concepts-less-css-style" media="screen" type="text/css">
body {
padding: 10px;
background: blue;
}
</style>
</head>
<body>
<script src="js/less-1.1.5.min.js" type="text/javascript"></script>
<script type="text/javascript">
jQuery(document).ready(function($) {
var my_id = $('style').attr('id');
var test = $('#less:concepts-less-css-style').text();
var test2 = $('#less:concepts-less-css-style').html();
alert(test + "#" + test2 + "#" + my_id);
});
</script>
</body>
</html>