get script text from html
code looks like below:
- <script type="text/javascript" src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js'></script>
<script>
jQuery(document).ready(function() {
// case 1
alert('case 1');
var h = jQuery("<div><script id='t'>var a=1;<\/script><\/div>");
alert( h.find("#t").text() );
// case 2
alert('case 2');
h = jQuery("<script id='t'>var a=1;<\/script>");
alert( h.find("#t").text() );
});
under IE, both alert blank.
under FF, the first one alert var a=1; but the second one is blank.
if change 1.3.2 to 1.4.2, all are blank.
so my question is:
how to get script text from a HTML code piece (which is from ajax)?
Thanks a lot