<script src="js/jquery-1.8.3.js"></script>
<script type="text/javascript">
$(function () {
$('#files').change(
function () {
var fileExtension = ['jpeg', 'jpg'];
if ($.inArray($(this).val().split('.').pop().toLowerCase(), fileExtension) == -1) {
//alert("Only '.jpeg','.jpg' formats are allowed.");
// $('#files').attr("disabled", true);
$('#lblmsg').html("Only '.jpeg','.jpg' formats are allowed.");
$(this).val('');
}
else {
$('#files').attr("disabled", false);
$('#lblmsg').html(" ");
}
})
})
</script>
<form id="form1" action="home.html">
<div>
File Upload <input type="file" id="files" ></input>
<input type="submit" value="submit" id="btnsubmit"></input>
</div>
<label id ="lblmsg" style="color:RED">****</label>
</form>
No comments:
Post a Comment