Increase content font written in input

Asked

Viewed 626 times

2

Good morning, I am new to Java Web programming, I am developing an application in which I want to write an input word, I want to select that word and increase that source, how can I do that? I’m having doubts :/

My select where selects which font:

 <select id="SelectAlterarFonte" class="form-control">
                                                <option value="12">Fonte 12</option>
                                                <option value="18">Fonte 18</option>
                                            </select>

My input where I will type.

 <h:inputText value="#{frameBean.objSvg.valueText1}" autocomplete="off" id="AlterarTxto"
                                                     styleClass="form-control" tabindex="0"/>

And lastly. I want to click this button and do the action:

  <p:commandLink id="btn_close_users_modal3"
                                               styleClass="btn btn-default" 
                                               validateClient="false" process="@this">
                                    <i class="fa fa-floppy-o fa-fw" /> #{bundle['system.ui.label.save']}
                                </p:commandLink>
  • 1

    But what language are you really using? Javascript, jQuery, Java ? And show us your code.

  • I’m using java, more da para fazer um javascript e chamar na pagina?

  • What can you do in this case?

1 answer

2


Would that be it? I made it with pure HTML and JS, adapt as your need.

function alteraTexto() {
    var tamanhoSelecionado = document.getElementById('SelectAlterarFonte').value;
    document.getElementById('AlterarTxto').style.fontSize = tamanhoSelecionado + "px";
}
 <select id="SelectAlterarFonte" class="form-control">
     <option value="12">Fonte 12</option>
     <option value="18">Fonte 18</option>
</select>

<input type="text" value="Texto" autocomplete="off" id="AlterarTxto" styleClass="form-control" tabindex="0"/>

<input type="button" value="Alterar" onclick="alteraTexto()"/>

  • that’s right. thank you very much

Browser other questions tagged

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