Jquery change id dynamicallly and keep functionality of original id

158 Views Asked by At

I need to change the ID of element in jquery. This I make with following code:

$('#tool_fhpath').attr('id', 'tool_fhpath2');

Changing id's works fine, but my problem is that element with new id does not interact as the original element. This part of code should be part of code in svg-editor where every button with id has some funcionality. I need to implement 2 buttons with same funcionality on one page. But I can't have more than one element on page. It is really hard for me to implement other "id" to have same funcionality, because I can not well oriented in the code of svg-editor. So I thought that simply exchange id and my problem will be solved. But changed id does not interact. Exist any sollution to keep all properties and functionality of original id, when the id is changed ?

0

There are 0 best solutions below