Skip to content

Add custom button #80

Answered by viresh-ratnakar
DKMiller71 asked this question in Q&A
Discussion options

You must be logged in to vote

Sure, I've done it myself in this puzzle. You do it from the customizeExolve() method that gets called automatically when using createExolve() (the Exolve(...) constructor also provides a parameter for such a function, if you're using the constructor directly).

function customizeExolve(puz) {
  const b = document.createElement('button');
  b.className = 'xlv-button';
  b.innerHTML = 'Dkm!';
  b.title = 'Click for Dkm!'
  b.addEventListener('click', (evt) => {
    alert('You clicked on Dkm!');
  });
  /**
   * You can append to puz.buttonRow1 if you prefer,
   * which you'd have to if the puzzle does not provide
   * solutions as there is no second row then.
   */
  puz.buttonRow2.appendCh…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by viresh-ratnakar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants