Skip to content Skip to sidebar Skip to footer

Custom File Input Using Jquery Restrict The User File Types And Filename If The User Click Check Box It Input File Disable

Currently working on file upload where the user can upload only jpeg and pdf files n the text field it has to show the filename. less than 5mb If user click the checkbox it shou

Solution 1:

1.To check whether a checkbox is selected or not you have use .is(':checked') like if ($('.accpt_chk').is(':checked')) {}
2. To add an attribute you can use .attr('name','value')

Demo

part of updated Js

$(document).on('click', ".accpt_chk", function() {
  if ($('.accpt_chk').is(':checked')) {
    $('.checkfile').attr('disabled', 'true')
  } else {
    $('.checkfile').removeAttr('disabled')
    $('.checkfile').prop('enabled', false);
    $(this).closest("#btn_selct").removeClass('cst_select').addClass('cst_select_dis');
    //$('#btn_selct').hasClass('.cst_select ').remove().addClass('.cst_select_dis');
  }
  //$('.qq-upload-button').prop('disabled', !this.checked);
});

Post a Comment for "Custom File Input Using Jquery Restrict The User File Types And Filename If The User Click Check Box It Input File Disable"