Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to make sure buttons events are only triggered once in Javascript/JQuery?
    primarykey
    data
    text
    <p>I'm new to JQuery, and Javascript, and I am using the JQueryUI ProgressBar, and every time somebody clicks on a button, then the progress bar animates and fills up. Is there a way to keep track of which buttons are already pressed to prevent the buttons from triggering the event again?</p> <p>Current HTML: </p> <pre><code> &lt;ul&gt; &lt;li&gt;&lt;a href="left/section1.html" target="leftcontainer" onClick="updateBar();window.presentation.location.href='right/section1/page1.html';;return true;"&gt;overview&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="left/section2.html" target="leftcontainer" onClick="updateBar();window.presentation.location.href='right/section1/page1.html';;return true;"&gt;key features&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#" onClick="updateBar()"&gt;customers&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#" onClick="updateBar()"&gt;accessories&lt;/a&gt;&lt;/li&gt; &lt;!--&lt;li&gt;&lt;a href="#"&gt;nav5&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;nav6&lt;/a&gt;&lt;/li&gt; --&gt; &lt;/ul&gt; </code></pre> <p>Current JQuery/JavaScript:</p> <pre><code>var percentage = 0; function updateBar() { percentage += 25; $('.ui-progressbar-value').stop().animate({ width: percentage+"%" }, 500) $('.middle').progressbar('option','value', percentage); if(percentage &gt; 100) { $('ui-progressbar-value').stop().animate({ width: "100%"}, 500); } } $(function() { $('.middle').progressbar({ value: percentage, complete: function() { alert('The progress bar is full'); } }); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload