It looks like you're new here. If you want to get involved, click one of these buttons!
<<set $counter to 1>> <<set $btntxt to $counter+1 + " more time(s)">> <span id="btn"> <<button $btntxt>> <<set $counter -=1>> <<if $counter eq 0>> <<replace "#btn">>No more tries!<</replace>> <<endif>> <</button>></span>
Comments
tried your way, but the button gets stuck after the second click. It seems the condition in <<else>> is never met or the button doesn't run the if macro after the first click.
Here's my go (based on yours):
I'd suggest looking at my example again—more closely this time. Here it is again, modified only to use you new "listen!"/"listen again" text, rather than what you originally asked for, and the <<audio>> macro invocation:
The example you posted in your last post did not work (I am not implying that it is your duty to provide working code). So in order to understand it, I tried to simplify it a bit (especially the part with the plural-s made it hard for me to understand), during which I obviously messed it up.
The above example does not work either (again, I am not implying that it is your duty to provide working code, I am just unable to fix the issue), so what I went for in the end is two buttons with replace macros:
Not elegant, but works.
Thanks again, euba
I tested both of the code examples I've given here and I guarantee you that they do, in fact, work. If they are not working for you, then you are simply doing something incorrectly. That's what I was getting at with my previous admonishment—it, again, was not an indication of offense.
Once you turn off Debug View the code example will work correctly.
Using my last example as the base, the following should work in both Play and Test modes—and the published HTML. I only altered the selector.
FIND: REPLACE WITH: