Kamahire
Kamahire

Reputation: 2209

jquery removeAttr is not working

I have two jsp files index.jsp file which contains this code which basicaly ajax call and get th html format data.

$.get("getDOData", { doNumber: obj.val()},
                    function(data){
                        /* alert('data is ' + data); */

                            $("#deliveryNoRow").after(data);
                            $("#getDoDetails").attr("disabled", "");
                            $("#deliveryOrderNo").attr("readonly", true);

                    })
                    .done(function() {
                        /* alert("second success");  */
                        $("#getDoDetails").attr("disabled", "");
                        originalSoldQty = $("#originalSoldQty").val();
                        //alert("originalSoldQty" + originalSoldQty);
                        $("#submitbutton").removeAttr("disabled");
                    })

             });

This return html code like [ $("#deliveryNoRow").after(data);] adding that html code in the page. That is working fine. If any error occurs in processin I am returning

<script type="text/javascript">
    $(document).ready(function(){
        alert("${error}");
        isErrorOccurred = true;
        //$("#getDoDetails").removeAttr("disabled");
        alert('r u ' + document.getElementById('getDoDetails'));
        document.getElementById('getDoDetails').disabled = false;
        $('#getDoDetails').prop('disabled', false);

    });
</script>

Instead of html, It gives me alert but other i.e. document.getElementById('getDoDetails').disabled = false; and $('#getDoDetails').prop('disabled', false); is not working.

How can enable button again if error occurred.

Thanks in advance

Upvotes: 0

Views: 275

Answers (1)

PSR
PSR

Reputation: 40338

use .prop()

$("#submitbutton").prop("disabled",false);

try this

Upvotes: 2

Related Questions