javascript - Form select option, send text option instead of value -
i tryed many options found here none works me.
i got html:
<div class="wrapper"> <span class="onamatxt"><b>smještaj:</b></span> <select name="roomname" id="chooseroom" class="inputt"> <option value="0room" selected> </option> <option value="1room">economy jednokrevetna soba</option> <option value="2room">economy dvokrevetna soba sa zasebnim krevetima</option> <option value="3room">economy dvokrevetna soba sa bračnim krevetom</option> <option value="4room">deluks dvokrevetna soba sa bračnim krevetom</option> <option value="5room">deluks dvokrevetna soba sa bračnim krevetom balkonom </option> <option value="6room">apartman sa terasom</option> <option value="7room">soba sa king-size krevetom spa kadom</option> <option value="8room">soba sa kvin-size krevetom spa kadom</option> </select> </div>
and when submit form message on email:
smještaj: 1room
instead of:
smještaj: economy jednokrevetna soba
the codes tried , similar one:
<script>$("#chooseroom option:selected").text();</script>
here full code:
<script src="https://code.jquery.com/jquery-3.2.1.js"></script> <script> $(function() { $("#chooseroom option:selected").text()); }); </script>
<!doctype html> <html lang="en"> <head> <title>lovac motel & restoran - rezervacija</title> <meta charset="utf-8"> </head> <body> <form id="contactform" action="php/rez.php" method="post" enctype="multipart/form-data"> <div> <div class="wrapper"> <span class="onamatxt"><b>ime prezime:</b></span> <input type="text" class="input" name="name"> </div> <div class="wrapper"> <span class="onamatxt"><b>e-mail:</b></span> <input type="text" class="input" name="email"> </div> <div class="wrapper"> <span class="onamatxt"><b>broj telefona:</b></span> <input type="text" class="input" name="phone"> </div> <div class="wrapper"> <span class="onamatxt"><b>smještaj:</b></span> <select name="roomname" id="chooseroom" class="inputt"> <option value="0room" selected> </option> <option value="1room">economy jednokrevetna soba</option> <option value="2room">economy dvokrevetna soba sa zasebnim krevetima</option> <option value="3room">economy dvokrevetna soba sa bračnim krevetom</option> <option value="4room">deluks dvokrevetna soba sa bračnim krevetom</option> <option value="5room">deluks dvokrevetna soba sa bračnim krevetom balkonom </option> <option value="6room">apartman sa terasom</option> <option value="7room">soba sa king-size krevetom spa kadom</option> <option value="8room">soba sa kvin-size krevetom spa kadom</option> </select> </div> <div class="wrapper"> <span class="onamatxt"><b>garaža:</b></span> <select class="input" name="garage"> <option> </option> <option>da</option> <option>ne</option> </select> </div> <div class="wrapper"> <span class="onamatxt"><b>odrasli:</b></span> <select class="input" name="adults"> <option> </option> <option>1</option> <option>2</option> <option>3</option> <option>4</option> <option>5+</option> </select> </div> <div class="wrapper"> <span class="onamatxt"><b>djeca:</b></span> <select class="input" name="children"> <option> </option> <option>1</option> <option>2</option> <option>3</option> <option>4</option> <option>5+</option> </select> </div> <div class="wrapper"> <span class="onamatxt"><b>datum dolaska:</b></span> <input id="datepicker3" type="text" class="input7" name="datein"> </div> <div class="wrapper"> <span class="onamatxt"><b>datum odlaska:</b></span> <input id="datepicker4" type="text" class="input7" name="dateout"> </div> <div class="dugmadkont3"><a href="#" class="button button22" onclick="document.getelementbyid('contactform').reset()">reset</a> <a href="#" class="button button22" onclick="document.getelementbyid('contactform').submit()">rezerviši</a></div> </div> </form> </body> </html>
if need php sending message email, gonna post it.
Comments
Post a Comment