1

Topic: Help to finish a script

Hello respected ! There is a code on javascript which at a clique on a word changes it for the set. If to click repeatedly this word is added repeatedly and all construction it is surrounded with curly inverted commas.
That is there was a word the text . After a clique on it it was replaced with a word 1 . Clicked once again, the construction {1|1} and . ... was formed
The code: https://jsfiddle.net/sa26uwxt/381 /
How to make the switch and to add the code that after switching at a clique the specific word was deleted?
That is clicked in a construction on the second word 1 , namely {1 | 1 |1} and there was a construction {1|1}, and the word selected above was deleted. And in the end if there was a construction {1|1} at removal of one of words environmental curly brackets too were removed, leaving simply a word?

2

Re: Help to finish a script

Somehow so (idea):
https://jsfiddle.net/sa26uwxt/382/

3

Re: Help to finish a script

Ruslan Damirovich, is interesting enough turned out smile only yet I will not understand as to use to the code up to the end.