Issue
Why does this not work?
<input type="file" id="kmlFiles2" multiple onchange="function(){alert('why does this not work')}()">
chrome gives me an error, Uncaught SyntaxError: Unexpected token (.
Firefox tells me SyntaxError: function statement requires a name.
But this does work?
<input type="file" id="kmlFiles2" multiple onchange="alert('but this does work')">
I am asking because I was was trying to use and MVC framework that injects code into the onchange event.
Solution
onchange="(function(){alert('this should work')})()"
Answered By - aljgom
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.