Sunday 15 March 2015

php - Get the values of all select options on change event javascript -


Once a change is recorded on the event, I want to know all the values ​​of a selected element.

The code is like this:

PHP

  & lt; Select name = 'variant' class = 'variantsselect' onchange = 'at (this .value)' & gt; & Lt; Option value = 'A' & gt; A & lt; / Options & gt; & Lt; Option value = 'A' & gt; A & lt; / Options & gt; & Lt; / Select & gt;  

JAVASCRIPT

  at function (value) {alerts (value); // This gives me the selected values};  

I need a value a & amp; Can b help someone change when the event is recorded on the selected element?

  & lt; Select name = 'variant' class = 'variantsselect' onchange = "javascript: valueselect (this)" & gt; Function Value Acct (SL) {var value = sel.options [sel.selectedIndex] .value; Alert (value)}  

Edit:

  & lt; Select name = 'variant' id = 'variant' class = 'variantsselect' onchange = "javascript: displayResult ()" & gt; Function display () {var x = document.getElementById ("version"); Var i; Var txt = "text:"; (I = 0; i & lt; x.length; i ++) for {txt = txt + "\ n" + x Option [i] .text; } Warning (txt); }  

No comments:

Post a Comment