attr('value', 'Please Wait...') is not working
I have already opened a dialog, there are form inside with InputGoodsAdd, which use to submit the form, but I want to set the button text as "please wait ..." and disable it.
- $(document).ready(function () {
- $('#InputGoodsAdd').click(function () {
- var inputGoodsLink = $('#InputGoodsLink').val();
- var inputGoodsQuantity = $('#InputGoodsQuantity').val();
- var inputGoodsRequirement = $('#InputGoodsRequirement').val();
- var inputGoodsSpecific = $('#InputGoodsSpecific').val();
- if (inputGoodsLink == '') {
- alert('請輸入以 http:// 為開始的正確貨品網址.');
- $('#InputGoodsLink').focus();
- return false;
- }
- else if (inputGoodsLink == '以 http:// 為開始的正確貨品網址' || !isHTTPAddress(inputGoodsLink)) {
- alert('請輸入以 http:// 為開始的正確貨品網址.');
- $('#InputGoodsLink').select();
- return false;
- }
- else if (inputGoodsQuantity == '') {
- alert('請輸入代購總數量.');
- $('#InputGoodsQuantity').focus();
- return false;
- }
- else if (inputGoodsQuantity == '總數量' || !isNumber(inputGoodsQuantity)) {
- alert('請輸入代購總數量.');
- $('#InputGoodsQuantity').select();
- return false;
- }
- else if (inputGoodsRequirement == '產品顏色, 大小或形狀的要求') {
- var oldBox = $('#InputGoodsRequirement');
- var newBox = oldBox.clone();
- newBox.attr('value', '');
- newBox.insertBefore(oldBox);
- newBox.select();
- oldBox.remove();
- if (inputGoodsSpecific == '指定要求的店舖') {
- var oldBox = $('#InputGoodsSpecific');
- var newBox = oldBox.clone();
- newBox.attr('value', '');
- newBox.insertBefore(oldBox);
- newBox.select();
- oldBox.remove();
- }
- }
- else if (inputGoodsSpecific == '指定要求的店舖') {
- var oldBox = $('#InputGoodsSpecific');
- var newBox = oldBox.clone();
- newBox.attr('value', '');
- newBox.insertBefore(oldBox);
- newBox.select();
- oldBox.remove();
- }
- $('#InputGoodsAdd').attr('value', 'Please Wait...');
- $('#InputGoodsAdd').attr('disabled', 'disabled');
- });
- });
The reason that I need to show a dialog to user that they use a button to confirm, but the button is ASP.NET button and using JQuery UI, I want to set value = Please Wait and disabled the button once user has press this button so that can prevent double-click request to server and set message Please Wait ...
I think this is not bug but I am not so sure how to do it correctly, could anyone fix this for me? attachment is my dialog box that showing to user.