JavaScript Getting value of drop down list JavaScript get value drop down list javascript,get value drop down

How to make that the all selected options, not the values, but the actual text, would be displayed somewhere?

Html:

<h1>Made your PC:</h1>

<div>
  <label>Processeor: </label><select id="processor" name="processor">
  <option class="label" value>Select Processor</option>
  <!-- Home Ware -->
  <option value="P1">Processor 1</option>
  <option value="P2">Processor 2</option>
  <option value="P3">Processor 3</option>
  <option value="P4">Processor 4</option>

  </select>
</div>

<p><strong>Only compatible components will show.</strong></p>
<div>
  <label>Select motherboard: </label><select id="motherboard" name="motherboard" class="subcat" disabled="disabled">
  <option class="label" value>Select Motherboard</option>
  <!-- Home Ware -->
  <option rel="P1 P2" value="AS1">ASUS RAMPAGE V EXTREME</option>
  <option rel="P2 P3" value="AS2">ASUS ATX DDR3 2600 LGA</option>
  <option rel="P1 P3 P4" value="GB1">Gigabyte AM3+</option>
  <option rel="P2 P4" value="MSI1">MSI ATX DDR3 2600 LGA 1150</option>

  </select>
</div>
<div>
  <label>Select RAM: </label> <select disabled="disabled" class="subcat" id="RAM" name="RAM">
  <option class="label" value>RAM Memory</option>
  <option rel="AS1 AS2 GB1" value="KI1">Kingston Value RAM</option>
  <option rel="AS1 AS2 MSI1" value="P5KPL">P5KPL-AM SE</option>
  <option rel="MSI1 GB1" value="960GM">960GM-VGS3 FX </option>
  </select>
</div>

<div>
  <label>Select Video Board: </label> <select disabled="disabled" class="subcat" id="video-card" name="video-card">
  <option class="label" value>Video Card</option>
  <option rel="MSI1 AS2" value="EVGA8400">EVGA GeForce 8400 GS</option>
  <option rel="AS1" value="XFXAMD">XFX AMD Radeon HD 5450</option>
  <option rel="MSI1 GB1" value="GTX750Ti">EVGA GeForce GTX 750Ti SC</option>
  </select>
</div>

Javascript:

$(function(){


  var $supcat = $("#processor"),
      $cat = $("#motherboard"),
      $subcat = $(".subcat");


  $supcat.on("change",function(){
    var _rel = $(this).val();
    $cat.find("option").attr("style","");
    $cat.val("");
    if(!_rel) return $cat.prop("disabled",true);
    $cat.find("[rel~='"+_rel+"']").show();
    $cat.prop("disabled",false);
  });

  $cat.on("change",function(){
    var _rel = $(this).val();
    $subcat.find("option").attr("style","");
    $subcat.val("");
    if(!_rel) return $subcat.prop("disabled",true);
    $subcat.find("[rel~='"+_rel+"']").show();
    $subcat.prop("disabled",false);
  });
});

I tried this one code that was posted earlier, but it only display one selection, right after picking, is there any way it could display all the selections and with my random text, like "Your selections"?:

<script>
    function myNewFunction(sel)
    {
        alert(sel.options[sel.selectedIndex].text);
    }
</script>

<select id="box1" onChange="myNewFunction(this);" >
    <option value="98">dog</option>
    <option value="7122">cat</option>
    <option value="142">bird</option>
</select>
Answer:1

This should give the actual label text, not the value, for a given select-element.

$(selector).find(":checked").html()

So if you want to show all of them, you could do something like this:

$("#video-card").on("change", function () {
    var choices = [];
  $("select").each(function() {
    choices.push($(this).find(":checked").html());
  });
  alert("You selected: " + choices.join(', '));
})

And here's a codepen for demo purposes

http://codepen.io/anon/pen/XbjKYQ

Answer:2
function myNewFunction(sel) {
    alert($(sel).val());
}

This should actually be working.
If that doesn't work, try to place a window.setTimeout(function() { ... }, 10); around your alert. It's possible that the browser calls the myNewFunction() method before it updates the selection value when the user clicks on one option.

EDIT: If you want the text instead of the value, use

alert($(sel).find("option:selected").text());
Answer:3

So, I've looked at other questions like this and they haven't really answered the questions. In short: I've worked with HTML, Java, VB, and whatever language MIRC uses(it's been a little under 10 ...

So, I've looked at other questions like this and they haven't really answered the questions. In short: I've worked with HTML, Java, VB, and whatever language MIRC uses(it's been a little under 10 ...

  1. external javascript call in html
  2. external javascript call function
  3. external javascript call
  4. calling external javascript function from html
  5. calling external javascript file from html
  6. calling external javascript function from php
  7. javascript calling external program
  8. calling external javascript file

have the below Javascript already, and a couple of Select Groups. When selecting one of the options in one of the groups, it fills the relavent text box with the text() of that option, and the ...

have the below Javascript already, and a couple of Select Groups. When selecting one of the options in one of the groups, it fills the relavent text box with the text() of that option, and the ...

Example placed here http://jsfiddle.net/aS87B/3/ Here are 3 input fields First input<br> <td class='exchange_rate1'> <input type="text" name="exchange_rate1" id='exchange_rate1' class=...

Example placed here http://jsfiddle.net/aS87B/3/ Here are 3 input fields First input<br> <td class='exchange_rate1'> <input type="text" name="exchange_rate1" id='exchange_rate1' class=...

  1. jquery input value change
  2. jquery input value set
  3. jquery input value change event
  4. jquery input value length
  5. jquery input value by name
  6. jquery input value empty
  7. jquery input value get
  8. jquery input value undefined
  9. jquery input value change listener
  10. jquery input value not updating
  11. jquery input value append
  12. jquery input value selector
  13. jquery input value clear
  14. jquery input value empty check
  15. jquery input value array
  16. jquery input value validation
  17. jquery input value update
  18. jquery input value not showing
  19. jquery input value remove
  20. jquery input value increment

I have cloned div duplicate elements in body with the class name "combo". I need to remove all duplicates except the original div element

I have cloned div duplicate elements in body with the class name "combo". I need to remove all duplicates except the original div element

  1. remove duplicate elements from array
  2. remove duplicate elements from list python
  3. remove duplicate elements from list
  4. remove duplicate elements from list java
  5. remove duplicate elements from array java
  6. remove duplicate elements from array javascript
  7. remove duplicate elements from sorted array
  8. remove duplicate elements from array c++
  9. remove duplicate elements from sorted linked list
  10. remove duplicate elements from unsorted array
  11. remove duplicate elements from array js
  12. remove duplicate elements from array python
  13. remove duplicate elements from vector c++
  14. remove duplicate elements from array ruby
  15. remove duplicate elements from array bash
  16. remove duplicate elements from linked list
  17. remove duplicate elements from array in php
  18. remove duplicate elements from string in java
  19. remove duplicate elements from string in python
  20. remove duplicate elements from linked list in python