Skip to content

How to add html elements with custom script #213

Answered by ansibleguy76
ni3aswal asked this question in Q&A
Discussion options

You must be logged in to vote
icon: bullseye
fields:
  - name: sample
    type: text
    default: Ansibleguy
  - name: field1
    type: html
    expression: >
      ((btn,msg)=>{
        window['myprefixFn'] = new Function(
          `
          return alert("Hi there ${msg}")
          `,
        );
        return `<button onclick="window.myprefixFn()" class="button is-success">${btn}</button>`;
      })('my button','$(sample)')
      

Replies: 2 comments 7 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
7 replies
@ni3aswal
Comment options

@ansibleguy76
Comment options

@ni3aswal
Comment options

@ansibleguy76
Comment options

Answer selected by ansibleguy76
@ansibleguy76
Comment options

@ansibleguy76
Comment options

@ni3aswal
Comment options

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