0

I know u can do something like this

$('#labelID').off('click'); // unbind click event
$('#labelID').no('click',func); bind it back with a func

but to rebind back in my case I don't have a function, because it is the default behavior of my form upload tags, like

<label>upload
<input type="file">
</label>
4
  • Please tell us what you are trying to do. Feb 26, 2015 at 4:17
  • This question already asked please check this [Bind unBind][1] [1]: stackoverflow.com/questions/17250308/… Feb 26, 2015 at 4:21
  • @EternalHour bind and unbind label Feb 26, 2015 at 4:27
  • @Pankaj how to bind back without specify the second param which is the function? because I want to keep the default behavior of type=file Feb 26, 2015 at 4:27

2 Answers 2

2

I think what you are trying to do is to, disable the file selection based on some condition, in that case I think you can just disable in file input field.

$('input[type="file"]').prop('disabled', true)
1
0

Use this

$('input[type="file"]').attr('disabled', 'disabled');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.