Given an input that may contain values ββsuch as:
<input type="hidden" value="XXXXXXX" />
<input type="hidden" value="XXXXXXX, YYYYYYYY" />
<input type="hidden" value="XXXXXXX, YYYYYYYY, ZZZZZZZZZZ" />
I want to use jQuery to delete: XXXXXXX, but if XXXXXXX has a comma after (XXXXXXX,), I need the comma to be removed.
This is what I have now:
uuid = XXXXXXX
.val(attachedUUIDs.replace(uuid + ',', '' ));
.val(attachedUUIDs.replace(uuid, '' ));
Ideas to make it clean? Thanks
source
share