I want to replace an existing file input field entirely with a text input field, with all properties intact like id
, name
, etc. How do I do that using jQuery?
Prelude:
I have an <input type="file" name=".." id=".." />
that I am using for AJAX based uploads. (yes, For IE, I am submitting the form using IFRAME
s.)
When the upload is done, I go into my success callback function, where I am trying to change the original <input type="file"
to <input type="text"
.
In other browsers, this is working fine when I simply run the following code:
$originalInput[0].type = 'text';
$originalInput[0].value = 'response code';
But this is not working in IE, where I came to know from SO that it is a security concern and hence not allowed. I want to write minimum code for this.