i’m trying to include a script to fancy box however it doesn’t work.
$("#addmsg").click(function () {
var msg = '<script type="text/javascript" src="/1.js"></script>';
$.fancybox({
'content': msg});
});
but a msg like this do work:
var msg = '<script>function foo(){alert("this works");}</script>';
msg += '<input type="button" value="Cancel" onclick="foo()"/>';
now the script i want to include is huge and i can’t write every line of it in quotation marks.
is there anyway to make it work? thanks!
I managed to solve the problem.
in my html file i added the button:
<button id="addmsg" href="#addmsg_div">ADD</button>the tag
#addmsg_divcontains my intended msg. in my .js file i wrote:$("#addmsg").fancybox();