on click button disabled click ent is working? using jquery

Posted by kumar on Stack Overflow See other posts from Stack Overflow or by kumar
Published on 2010-06-06T19:10:14Z Indexed on 2010/06/06 19:12 UTC
Read the original article Hit count: 210

Filed under:
<div> 
   <input id="PbtnSelectAll" type="button" class="button" value="Select All" />
   <input id="PbtnSubmit" type="submit" class="button" value="Save" />
   <input id="PbtnCancel" type="button" class="button" value="Cancel" />
</div>
</fieldset>
<% } %>

<script type="text/javascript">
    $(document).ready(function() {
        $('#PbtnSubmit').attr('disabled', 'disabled');
        $('#PbtnCancel').attr('disabled', 'disabled');
        $('#PbtnSelectAll').click(function() {
            $('#PricingEditExceptions input[type=checkbox]').attr('checked', 'checked');
            $('#PbtnSubmit').attr('disabled', false);
            $('#PbtnCancel').attr('disabled', false);
            $('fieldset').find("input:not(:checkbox),select,textarea").attr('disabled', 'disabled');
            $('#genericfieldset').find("input,select,textarea").removeAttr('disabled');

        });
        $('#PbtnCancel').click(function() {
            $('#PricingEditExceptions input[name=PMchk]').attr('checked', false);
            $('#PbtnSubmit').attr('disabled', 'disabled');
            $('#PbtnCancel').attr('disabled', 'disabled');
            $('#exc-flwup').val('');
            $('#Inquiry').val('');
            $('#comments').val('');
            $('#ResolutionCode option:eq(0)').attr('selected', 'selected');
            $('#ReasonCode option:eq(0)').attr('selected', 'selected');
            $('#ActionCode option:eq(0)').attr('selected', 'selected');
            $('fieldset').find("input,select,textarea").removeAttr('disabled');
        });
        $('#PbtnSubmit').click(function(event) {
            $('#PricingEditExceptions input[name=PMchk]').each(function() {
                if ($("#PricingEditExceptions input:checkbox:checked").length > 0) {
                    var checked = $('#PricingEditExceptions input[type=checkbox]:checked');
                    var PMstrIDs = checked.map(function() {
                        return $(this).val();
                    }).get().join(',');
                    $('#1_exceptiontypes').attr('value', exceptiontypes)
                    $('#1_PMstrIDs').attr('value', PMstrIDs);
                } else {
                    alert("Please select atleast one exception");
                    event.preventDefault();
                }
            });
        });
        function validate_excpt(formData, jqForm, options) {
            var form = jqForm[0];
        }
        // post-submit callback 
        function showResponse(responseText, statusText, xhr, $form) {

            if (responseText[0].substring(0, 16) != "System.Exception") {
                $('#error-msg-ID span:last').html('<strong>Update successful.</strong>');
            } else {
                $('#error-msg-ID span:last').html('<strong>Update failed.</strong> ' + responseText[0].substring(0, 48));
            }
            $('#error-msg-ID').removeClass('hide');
        }

        $('#exc-').ajaxForm({
            target: '#error-msg-ID',
            beforeSubmit: validate_excpt,
            success: showResponse,
            dataType: 'json'
        });
        $('.button').button();
    });
</script>

this on begin form submit if I click Disabled Save and Cancel buttong still working after disabling also?

i can see button is disbled but its working on click? when I click cancel its and not enabling back? still the button shows disbaled/

thanks

© Stack Overflow or respective owner

Related posts about jQuery