I have created a function createFileSelect() which creates elements:
function createFileSelect() {
var fSpan = $("<span/>",
{
"id" : "fileUpload-span",
"class" : "btn btn-add",
"text" : "Add a file.."
});
var fInput = $("<input/>", {
"type": "file",
"name": "files[]",
"id": "fileUpload"
});
return $(fSpan + fInput);
}
Then I call this using:
$("#fileUpload-holder").append(createFileSelect());
However, I am getting an error
Syntax error, unrecognized expression: [object Object][object Object]
How can I get this working with the (2) elements into the dom using a function?
Thanks