How can I disable my pop-up button?

How can we disable replay for an audio in HTML5 if we have a designated button for playing the audio in IE?

  • You can see detail of this question here at StackOverflow http://stackoverflow.com/questions/24416981/how-do-de-activate-the-play-button-in-ie-after-the-audio-has-been-played <audio controls="" id="audio2" style="display:none"><source src="http://langcomplab.net/Honey_Gatherers_Master.webm" style="width:50%" type="audio/webm" /> <source src="http://langcomplab.net/Honey_Gatherers_Master.mp3" style="width:50%" type="audio/mp3" /> Your browser doesn&#39;t support this audio format.</audio></div><p>&nbsp;</p><div><button name="play" onclick="disabled=true" style="height:25px; width:200px" type="button">Play Story</button></div>

  • Answer:

    I'm not sure why IE doesn't do what you want but I guess one never truly understands why IE responds like it does. However, you might want to combine the two actions in the questionClick function. (Maybe that onClick event handler stops the  onClick attribute from firing) For example:     Qualtrics.SurveyEngine.addOnload(function()     {         /*Place Your Javascript Below This Line*/         var aud = document.getElementById('audio2');         this.questionclick = function(event,element){                 if((element.type == "button") && (http://element.name == "play"))             {                 aud.play();                 // remove the element                 element.parentNode.removeChild(element);                 // or set it to disabled, what you like                 element.disabled = true;             }             }             }); Don't forget to remove the onClick attribute from the button:     <div><button name="play" style="height:25px; width:200px" type="button">Play Story</button></div> You can also set a variable on pageload. Check it before you start playing and then set it again. Example:     // Set a variable     var hasPlayed = false;     Qualtrics.SurveyEngine.addOnload(function()     {         /*Place Your Javascript Below This Line*/         var aud = document.getElementById('audio2');         this.questionclick = function(event,element){                 if((element.type == "button") && (http://element.name == "play"))             {                 // Check if audio hasn't played before                 if(hasPlayed == false) aud.play();                 // Flip the variable to make sure it won't play on next click                 hasPlayed = true;             }             }             });

Maarten Wolzak at Quora Visit the source

Was this solution helpful to you?

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.