0

I have one button which you click it changes the name from Edit to Save and perform some functionality. This works fine. Now i have two tabs(Tab1 and Tab2).

When edit is clicked,it enable the fields and change the name to save and you save and now am doing the validations. when you click edit and decided to move to Tab2 without saving. I want disable the fields and change the button to edit from Tab1. this will mean you have to redo the process by clicking edit again.

My code:

function SaveAddress() {
    var obj = $('#btnsave')
    if (buttonObj.val() == "Edit") {
        buttonObj.val("Save");
        //this will enable and edit. it works fine
    }
}

function tbsvalidation()
{
    $('#Tab1').click(function ()
    {
        //this disabled the fields when clicking tab
        $('#txtname').prop('disabled', true);
        $('#txtSurname').prop('disabled', true);

        //i want to change  button name back edit
        $('#btnsave').prop('Save','Edit');
    }
}
ADreNaLiNe-DJ
  • 4,787
  • 3
  • 26
  • 35

0 Answers0