You can wrap it with a div and add class of:
display:flex;
function dropdownTip(value) {
console.log(value);
document.getElementById("result").innerHTML = value;
}
.section {
display: flex;
}
<div class="section">
<label for="letters">Amount Of Letters In Order:</label>
<select onChange="dropdownTip(this.value)" name="search_type" style="margin-right:10px; margin-top:2px;">
<option selected="selected" value="1">1</option>
<option value="More then One Letter">2</option>
<option value="More then One Letter">3</option>
<option value="More then One Letter">4</option>
<option value="More then One Letter">5</option>
<option value="More then One Letter">6</option>
<option value="More then One Letter">7</option>
<option value="More then One Letter">8</option>
<option value="More then One Letter">9</option>
<option value="More then One Letter">10</option>
</select>
<div id="result"></div>
</div>
I have a selection drop down box that shows text when an option is above 1.
I have many drop down boxes which are all the same but the code only works for the first one
Thanks for the replys, yes perfect I used span instead of div to fix text position issue.
The only thing left is it the result, the issue I have is its part of a php file which auto generates a list of orders how could I make each field unique when it auto generates, so the function effects them all instead of the first one.
Here is the code
function dropdownTip(value) {
console.log(value);
document.getElementById("result").innerHTML = value;
}
<label for="letters">Amount Of Letters In Order:</label>
<select onChange="dropdownTip(this.value)" name="search_type" style="margin-right:10px; margin-top:2px;">
<option selected="selected" value="1">1</option>
<option value="More then One Letter">2</option>
<option value="More then One Letter">3</option>
<option value="More then One Letter">4</option>
<option value="More then One Letter">5</option>
<option value="More then One Letter">6</option>
<option value="More then One Letter">7</option>
<option value="More then One Letter">8</option>
<option value="More then One Letter">9</option>
<option value="More then One Letter">10</option>
</select>
<span id="result"></span>
image1
Image2
Any help would be greatly appreciated.
Thanks for the replys, yes perfect I used span instead of div, learn something new everyday. The only thing left is it the result, the issue I have is its part of a php file which auto generates a list of orders how could I make each field unique when it auto generates.
Thanks for the reply. I needed up just changing div to span to fix that bit of the question, still stuck on making the JavaScript function work on many of the same dropdowns on the same page.