I have a function where I append an element to another element:
$("#frmUrl").addClass("hideUrl").css("margin","0").append(' <span class="uico ui-icon-carat-1-w icoSpan"></span>');
Naturally, when I call the same function again, another is appended. How can I rewrite this string to append this span only one?
Well there are 3 things you can do.
One is to create a flag after appending then check
And the second one is to check if the DOM already exist on the target DOM
And the third one is to check if the element already exist on your target element, by checking its existence on your target