I am trying to implement and undo feature in my webpage. It is a table full of editable texboxes so coming up with an id was hard. I decide to make an id name based of the table inforamtion. Here is an id for example:
HW3=:25626=:10000
HW3 is the header, 25626 is the id column for the row and 10000 references this table. For the undo feature i get the id by using
$(this).attr('id);
and this funciton is called based on the event focus or click that is why 'this' works. I take the current value and add it to the end like
$(this).attr('id)+":="+old_value;
This is done becuase the id name is seperated by "=:" so i can do two splits to get this data back in parts. Might not be best I understand.
The problem i am having is when I try to pull out the id and put it back as an element I get the error:
Uncaught Error: Syntax error, unrecognized expression: #HW3=:25626=:10000
I am trying to do:
var s = "#"+temp[0];
var element = $(s);
temp[0] is = to HW3=:25626=:10000. It is the second line throwing this error.
IMPORTANT!!! The table that has the id that I am using is not created in the begining. JQuery calls a method that builds it after page loads. This method can not be access until after the table is created. I understand that you can not bind events to elements until after they load but I'm not sure if the is that same case since i will never try to undo on a textbox that is not present. After all it had to be present to be inserted into the Undo object already.
Any help is appreciated.