[Fixed]-Django – cant pass selected tag into js (ajax code)

1👍

You can do something like that

function loadDoc2(value) {
  alert(value);
}
<input type="submit" onclick="loadDoc2(document.getElementById('shahr-select').value)" value="continue" style="height:50px;">

<select id="shahr-select" style="direction: rtl;width:200px;height:50px;">
  <option class="shahr-options" value="1">first</option>
  <option class="shahr-options" value="2">second</option>
  <option class="shahr-options" value="3">third</option>
</select>

the .value on a select will get the selected value

👤user3

Leave a comment