0

I can get one change, but not the second, not sure if it has to do with document.ready and I need another value?

$(document).ready(function() {
  $("#pause").click(function() {
    $("#stopme").attr('value', 'Resume');
    document.getElementById('stopme').id = 'resumeme';
    document.getElementById('pause').id = 'resume';
  });

});
$(document).ready(function() {
  $("#resume").click(function() {
    $("#resumeme").attr('value', 'Pause Boxes');
    document.getElementById('resumeme').id = 'stopme';
    document.getElementById('resume').id = 'pause';
  });

});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<a href="javascript:void(0);" id="pause"> <input type="button" value="Pause Boxes" class="btn btn-primary btn-lg" id="stopme"> </a>
Barmar
  • 741,623
  • 53
  • 500
  • 612
Pete Dawg
  • 58
  • 5
  • You shouldn't put a button inside an anchor, see https://stackoverflow.com/questions/6393827/can-i-nest-a-button-element-inside-an-a-using-html5 – Barmar Oct 20 '19 at 14:57
  • Don't change the IDs, just have the handler check the value and do whatever is appropriate. – Barmar Oct 20 '19 at 15:00

0 Answers0