element stops firing jQuery after 2nd click -



element stops firing jQuery after 2nd click -

i have anchor tag want utilize toggle class name on parent element.

the code works fine 2 clicks of anchor click doesn't register jquery anymore.

html

<div class="toolbar"><form method="post" action="..." id="facsearch" name="facsearch" onsubmit="facsearch(document.facsearch); homecoming false;"> <a href="..." class="advanced-toggle">advanced</a></form></div>

javascript

$('#facsearch').on('click', '.advanced-toggle', function(e) { console.log($(this)); e.preventdefault(); $('.toolbar').toggleclass('is-advanced'); var mylink; if($(this).text() == 'advanced') { var mylink = $(this).text('close advanced'); } else { var mylink = $(this).text('advanced'); } homecoming false; });

jquery

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -