Span Class String Replace On Click?
I'm hoping someone might be able to shed some light on how I can replace a span class identifier using JQuery.
The current code which does not work is as follows:
- $('#my-navicons a span class').text(function(index,text){
- if (this.nextSibling.nodeValue = my-menu-openicon' {
- this.nextSibling.nodeValue = this.nextSibling.nodeValue.replace('my-menu-openicon', 'my-menu-closeicon');
- }
- else {
- this.nextSibling.nodeValue = this.nextSibling.nodeValue.replace('my-menu-closeicon', 'my-menu-openicon');
- }
- });
The respective html code is:
- <div id="my-navicons" class="show-for-small-only my-navframe scale-065"><a class="left-off-canvas-toggle menu-icon" href="#"><span class="my-menu-openicon"></span></a></div>
The framework currently being used is Foundation 5.5.2, if that is needed.
Any thoughts would be greatly appreciated.