I im creating a javascript file using addElemend and childAppend to add a new
Ive written the code here http://jsfiddle.net/faYMH/18/
But for some reason it isnt working. If I replace the file upload field within the innerhtml with a simple it does work!
Can anyone spot the problem / put in some input how to accomplish what i want?
Thanks!
Jonah
There’s a few things wrong with that.
JSFiddle problems
First of all, you still have the framework settings set to “onLoad” and “Mootools”. You’ll want it to be one of the “no wrap” options and “No-Library (pure JS)”. Secondly, you’re putting the script in a
scripttag in the HTML pane. There’s a JavaScript pane specifically for JavaScript.JavaScript problems
You have some inline HTML in your JavaScript:
You’re using double quotes (
") for your JavaScript string as well as inside the HTML. Try using single quotes for the JavaScript string delimiters, like this:The HTML inside the string is also not valid. It will try to generate HTML like this:
There’s no closing quote. Fix that:
You might also want to remove the stray
1, though it doesn’t break the script.Result
Here it is, after these changes and a few more.