I have an issue in my JavaScript function.
Below is my js code:
function abc(formobject){
var ext =".txt";
var abc=".doc,docx";
if(abc.search(ext) < 0){
alert("hi");
formobject.file.value="";
return false;
}
return true;
}
<input type="submit" id="button" value="submit" onclick="return abc(this.form);">
Here on click of submit button I am calling abc() js function and uploading the file. It executes the logic and if the file is of not valid extension it should throw alert and clear the values of browse button. Its happening in Mozilla, but the values are not getting cleared in IE8. Can anyone help me on this?
File is the <html:file property="file"/> which I am uploading here.
Instead of
try using
Hope this helps.