Thursday, 15 August 2013

Changing type of an input

Changing type of an input

I want to change the type of an input on click of a button but it doesn't
work. I tried this:
$('.addPhoto').click(function(){
$(this).siblings('.auto_image').prop("type", "file");
});
It doesn't do anything at all. I searched on google and came across this:
JQuery change type of input field
It says it is possible to do it with straight DOM, but how would I select
the class of a sibling with DOM?

No comments:

Post a Comment