enginemike — 2013-04-13T14:51:30-04:00 — #1
I have a jquery function that will upload an image to the server and then back to the html page. The image transfer works fine but I am trying to enable a button on transfer completion but I not meeting with success. I am sure I am missing something but do not see it. If anyone can offer a suggestion I would appreciate it. The function is
var result = $(this).contents().text();
if (result != '')
if (result == 'Err:big')
if (result == 'Err:format')
$('#button_three').attr('disabled', false); <==== this is the code not working correctly, or at least as I think it should
paul_wilkins — 2013-04-13T16:55:42-04:00 — #2
The standard way to disable a button is with:
which results in:
<button id="button_three" disabled="disabled">...</button>
To enable that button again, you remove the disabled attribute using the removeAttr method:
enginemike — 2013-04-13T17:32:03-04:00 — #3
Thank you for the response and the lead.
I am now working on the theory that the script does not see the button id for some reason. Problem is that the button is generated using the DOM createElement method so I am sort of working blind.
Still learning. Thanks
paul_wilkins — 2013-04-13T17:37:02-04:00 — #4
It could be a matter of timing then. Can we see a test page that demonstrates the issue, from which we can investigate further?
enginemike — 2013-04-14T00:15:03-04:00 — #5
Hello. Hope I have this figured out.
I placed all relevant files in the attached zip file. I believe the main thing is the menu.js file, specifically the function: addButton(name). That is where the issue is to be found. But better too much information rather than too little. The actual site is on my desk top server so I am afraid that you cannot access it.
Basically this function opens an image upload window. The point is to send an image to the server and then display it on the html page. The button, button_three should become active when an image is loaded. Pressing the button will then place the image in the proper sever file. I have in mind to disable the button in the event of an error.
Hope this makes sense.
Thank you for taking a look. By the way, the next day or so I will be traveling so looking at the forum will be kind of hit or miss.