Link to home
Start Free TrialLog in
Avatar of dannyg280
dannyg280Flag for United States of America

asked on

Javascript: Find and Enable Submit Button in Table

I have a dynamically created table. Each row of the table includes form elements. It includes a drop down and a submit button.
The submit button is disabled by default and I want in enabled when I change the drop down.
The following function works great in making changes and calculation on the other data in the row, but I can't seem to get the SubmitButton to enable. Can someone tell me what I'm doing wrong?

// Chnages Op on rank change
	$(".rank").change(function() {
    var $rankop = this.value; // get Rank value
    var $catrow = $(this).closest("tr");    // Find the row
    var $catop1 = $catrow.find(".catop").text(); // Find cat Op
	var $baseop = $catrow.find(".baseop").val(); // Find baseop
	var $catop = ($rankop * $baseop); // Multiply ranking x op for new op 
	    $catop =$catop.toFixed(2);    // format to 2 decimal points
		
	$catrow.find(".rankop").val($rankop); // change value of hidden field calcop for form submit
	$catrow.find(".calcop").val($catop); // change value of hidden field calcop for form submit
	$catrow.find(".catop").text($catop); // change text of catop cell to new op
	$catrow.find(".SubmitButton").disabled = false; // Enable Submit Button. This is part that does not work

});	

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Also change your line 13 to this

$catrow.find(".SubmitButton").prop({disabled: false});

Open in new window


Use the prop() method
Avatar of dannyg280

ASKER

Perfect. Thank you