Thursday, June 13, 2013

jQuery clear a file input field

<input type="file" id="control"/>
<button id="clear">Clear</button>

var control = $("#control");

$("#clear").on("click", function () {
    control.replaceWith( control = control.clone( true ) );
});

No comments:

Post a Comment