Recover Chosen Jquery value

Asked

Viewed 218 times

2

I have two Select Chosen in my form, what I’m doing is:

Inserir Item

That is, when typing if you can’t find anything related, I have the link 'insert item', which opens me a modal, until everything works.

The big problem is that, I need to transfer the typed text to an input that is in the modal, I could not do, but, I believe it has to do with this line, inside the file Chosen.jquery.js.

return this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || "Nada encontrado <br><br> <a href='#' id='chama_modal_motivo_servico' class='chama_modal_motivo_servico' >Incluir este item</a>";

jsFiddle: http://jsfiddle.net/sNniffer/5ctjt6ug/

  • You say in the question "I need to transfer the typed text to an input that is in the modal". Where is this input? where is the modal and the link "include item"?

1 answer

2


Solved,

Changing line 886 of Chosen.jquery.js. It is possible to recover the contents of the select with the variable, Terms. What I did was, take the value of Terms and go to the href of the link.

var valor_input = terms;
no_results_html = $('<li class="no-results"> Nada Encontrado ' + this.results_none_found + ' "<a href="#" id="chama_modal_motivo_servico" class="chama_modal_motivo_servico" data-id="'+ valor_input +'"><span></span></a>"</li>');
  • Pf explains the answer to others who have the same problem learn and understand the solution.

  • @sNniffer like you did?

  • Opa amigo, just create a modal, change the line 886 of chossen.jquery.js. In this line you have the return if you do not find the result. Just change the content of the return

Browser other questions tagged

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