I use javascript (jQuery) to toggle text of html-element (span):
function TextToogle(element, text) {
if (element.html() == '-' + text) {
element.html(text.replace(element.html(), '+' + text));
}
else {
element.html(text.replace(element.html(), '-' + text));
}
}
I give two arguments for my function: 1) element - html Object 2) text - default text of span
My goal is toggle the span text from "+text" to "-text" and vice versa.
But script doesn't work correctly. When function toggle text to "+text", as result I see "text". The toggle to "-text" works correctly.