Activate Button

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


$(document).ready(function()
{
	$('#image_upload_form').submit(function()
	{
		$('#product_type_image').attr('src', '../images/misc/loading.gif');
	});
	
	$('iframe[name=upload_to]').load(function()
	{
		var result = $(this).contents().text();
		$('#button_three').attr('disabled', false);

		if (result != '')
		{
			if (result == 'Err:big')
			{
				$('#product_type_image').attr('src', '../images/misc/imagebig.png');
				return;
			}

			if (result == 'Err:format')
			{
				$('#product_type_image').attr('src', '../images/misc/imageformat.png');
				return;
			}

			$('#product_type_image').attr('src', $(this).contents().text());

                        $('#button_three').attr('disabled', false); <==== this is the code not working correctly, or at least as I think it should
		}
	});
});

Thanks

The standard way to disable a button is with:


$('#button_three').attr('disabled', 'disabled'); 

which results in:


<button id="button_three" disabled="disabled">...</button>

To enable that button again, you remove the disabled attribute using the removeAttr method:


$('#button_three').removeAttr('disabled'); 

Thank you for the response and the lead.

There must be something else going on because I tried this nine ways to Sunday and it does not work. I see no errors generated. I put a javascript alert tag immediately before the code in question and I do see a pop up notice and then a failure to execute.

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

It could be a matter of timing then. Can we see a test page that demonstrates the issue, from which we can investigate further?

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.