So I am a little confounded here. I do not understand why script executes when placed with jquery's .html()
but not with innerHTML
. I looked at the source code for jQuery's .html
and it still seemed that innerHTML
was being used. Can anyone explain this behavior?
I came across this during an ajax response. I was getting back html and a script
tag with some javascript in it, and I usually use html
, but for some reason had used innerHTML
this time thinking there was no difference.
I understand that this might seem to be localized, so I made a jsFiddle with a timeout that behaves similar to an ajax response in order to highlight the issue.