I’ve a function, which should remove a li element from a list identified by the id.
I use jQuery and this call
$("#selector").find("li[id='" + id.substring(4) + "']").remove();
The call started with a click on a button.
In Firefox it works without problems … in Chrome not.
Has anyone an idea why?
2
Answers
Thanks for your answer.
to 1: it's the correct value to 2: i try it, but it doesn't work to 3: same as 2.
further ideas?
The issue might be due to differences in how Chrome and Firefox handle certain JavaScript/jQuery functionalities. Try the following:
1 : Ensure
id.substring(4)
returns the correct value. Useconsole.log(id.substring(4))
to verify.2: Escape special characters in the ID:
3 : Wrap the removal code in a setTimeout to handle reflow issues: