I am reading rows from a mySQL table and returning them to jQuery to display (using HTML, bootstrap) for the user to enter a value against. When the value is updated by the user the action is capture by jQuery and the value is returned to be updated in the table (so I need the row's key in order to update the correct row).
So the user can not change the key, and have a different (wrong) row updated in the table, I am encrypting the row keys before sending them to the jQuery. I use the row's key as the id for each HTML line so each has a unique id and I know which has been update.
//Loop for each encoded_task_detail_ID
String summer = "ta" + encoded_task_detail_ID;
<textarea class='summernote col-lg-12 col-md-12 col-sm-12 col-xs-12' id="+ summer +" name='ymSpecificLine' rows='1'>
//end loop
Some rows are name='ymSpecificLine' and some are not. So in the jQuery I check:
var taKey = "#ta" + val_awardDetailID;
var val_ymSpecific = "N";
var val_ymSpecificLine = "";
alert("1");
if ($(taKey).attr('name') === "ymSpecificLine"){ //I have tried == here as well
alert("2"); //Not displayed when error occurs
val_ymSpecific = "Y";
val_ymSpecificLine = $(taKey).val();
};
If the key (val_awardDetailID - same as encoded_task_detail_ID) is "Nzly" then this works. However, when the key is "MjM5MQ==" then there is a console error:
Uncaught Error: Syntax error, unrecognized expression: #taMjM5MQ==
I thought it may have something to do with it ending in "==" so I added an "A" to give "#taMjM5MQ==A". However the same error was returned.