Button with two value only with html is possible?

Asked

Viewed 335 times

1

You want to put two actions in the value field of a button, using html only. It is possible?

My original button:

<button type='roll' name='roll_arma1' value='&{template:default} {{name=Ataque @{nomearma1} @{arma1}}} {{Sucessos=[[{5d4}>3+@{arma1}]]}}'>

i wanted to insert within the value the #macro1 action, which performs a function within the site I use, roll20.net

or turn these two buttons below into a single:

<button type='roll' name='roll_arma1' value='&{template:default} {{name=Ataque @{nomearma1} @{arma1}}} {{Sucessos=[[{5d4}>3+@{arma1}]]}}'></button>

<button type='roll' name='roll_arma1' value='!ammo @{selected|character_id} municao1 -1'></button>
  • 1

    I couldn’t understand your doubt, I could explain it better?

  • It is unclear what you want to do. Please edit the question and describe the problem better. Also seek to make a [mcve] and take the opportunity to make the [tour].

  • You say 2 VALUES or 2 ACTIONS as Submit, Click?

  • My original button: <button type='roll' name='roll_arma1' value='&{template:default} {{name=Attack @{name1} @{arma1}}} {{Hits=[[{5d4}>3+@{arma1}]]}}'> I wanted to insert within the value the #macro1 action, which performs a function within the site I use, roll20.net

  • Daniel this information you made available in the comments is essential in the question, feel free to edit it if you want.

  • @Danielreis are you using angular? .

Show 1 more comment

1 answer

1

You can create your own properties for your html tags using the word data-:

<button type='roll' id='roll_arma1' data-valor-um='meu valor 1' data-valor-dois='meu segundo valor'></button>

To access them, use:

    function pegaValores(){
      var valor1= $("#roll_arma1").data('valor-um');
      var valor2= $("#roll_arma1").data('valor-dois');
      console.log(exigeIdade);
    });

Then, call the function in the onclick event from your button. Adapt according to your need.

  • It worked or you need something more?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.