On Click of the Edit Button , i am showing a Modal with the name present under corresponding data attribute data-catname
I am changing the name inside the Modal and updating the text and also the corresponding data attribute data-catname
But When i reopen the Modal , its showing me the prevoius name
This is my code
function addCatSbmt()
{
var category_name_modal = $("#catnameedit").val();
var category_id_modal = $("#catidhiddenedit").val();
var trid = category_id_modal;
var texttoreplace = category_name_modal;
$("#span" + trid).text(texttoreplace);
$('#' + trid).find(".editcatclick").attr('data-catname', texttoreplace);
$('.closetagdialog').trigger('click');
}
How to Reproduce :
1.Click on Edit button (TCS) , it will open a POP UP , with the name TCS , change the name to something else .
2.Click again the same Edit button , it is showing TCS only