I am using this, valums ajax fileupload: http://valums.com/ajax-upload/ , It is working fine for me. I want to disable the upload button as I upload an image and want add 2 more buttons beside it "Delete" and "View". How would I do this using existing JS file.
Asked
Active
Viewed 1,902 times
0
-
2showing some of your code would help.. dont you think so..? – Sudhir Bastakoti Jan 19 '12 at 07:25
-
something similar here: http://stackoverflow.com/questions/5122602/how-to-disable-ajax-upload-button – Sudhir Bastakoti Jan 19 '12 at 07:31
-
Hey Sudhir, definitely I'll post like this next time. Thanks a lot guiding me. – Lalit W Jan 19 '12 at 09:06
3 Answers
0
without any code all we can do is guess, but assuming there are 2 elements, a button with id='upload-button' that is a child of an element with id='upload-button-container' you could do something like the following:
$("#upload-button").hide();
$("#upload-button-container").append($("<button type='button'>Delete</button><button type='button'>View</button>"));

Jason
- 15,915
- 3
- 48
- 72
0
you can do it as below
$.ajax({
....
....
....
success:function(resposne){
// do something
$('#upload').attr("disabled", true);
$('#upload').parent().append('<input type="button" value="delete" id="delete"/>
<input type="view" value="click" id="view"/>');
}
});
then for handling delete and view button click, since these are dynamically
added element you have to delegate
event
handler
using on
. The normal
click
handler
will not work on dynamically
added elements.
$('body').on("click","#delete",function(){
// do the delete operation
});
$('body').on("click","#view",function(){
// do the view operation
});

dku.rajkumar
- 18,414
- 7
- 41
- 58
0
So, if your upload button has the id "upload_button" and the two buttons you want to add are already there, but hidden. (and with the class "hidden_btn")
with jquery, you can do this:
$("#upload_button").attr("disabled","disabled")
$(".hidden_btn").show()

BananaNeil
- 10,322
- 7
- 46
- 66