I am working with a jquery plugin here, which I am trying to use, but unfortunately, the example uses eval
on pre
tags to run the code. An example of this is here.
In a nutshell, the author has some <pre>
tags like so:
<pre>
//code
</pre>
and then runs:
<script type="text/javascript">
$(function() {
$('form[action="#"]').attr('action', document.location.href);
$('pre').each(function(i, e) {
eval(e.innerHTML);
});
});
</script>
My question now is how do I use the code within the <pre></pre>
tags as script tags. So, when I do:
<script>
//// code from <pre></pre> tag
</script>
.. the code fails to work... Any directions to solve this mystery would be nice.
答案 0 :(得分:0)
If you'd just change the "pre" to "script" you will probably cause the code withing the tags to run on the load of the page. What do you desire to accomplish?