selected value according price and rate show with javascript, Set and get range values, text, or formulas using the Excel JavaScript API

<html><head></head><body> <form action="" method="POST">
<div style="width:100%; margin-left:1%;">
<div class="col-sm-3">
<btn-primary6 class="m-0 font-weight-bold text-primary">Update Account Mode
<select name="accountmode" onchange="myaccountmode(this.value)"  class="form-control">
    <option> <?php echo $row['accountmode'];?> </option>
<option> Select Account Mode </option>
<option value="Paid Plan"> Paid Plan 50% off</option>
<option value="Plus Plan"> Plus Plan 80% off</option>
</select>
</btn-primary6></div>
<div class="col-sm-3">
<btn-primary6 class="m-0 font-weight-bold text-primary">Selected Plan Price 
<input required="required" type="text" class="form-control" placeholder="auto show plan price"  name="planprice" id="charges" >
</btn-primary6></div>
<div class="col-sm-3">
<btn-primary6 class="m-0 font-weight-bold text-primary">Upgrade Users 
<button class="btn btn-primary bg-danger text-white btn-block" name="Upgrade" type="submit">Upgrade</button>
</btn-primary6></div>
</div>
</form>
<script>
function myUSER(value) {
  document.getElementById("username").value = "" + value;
}			  
</script>
<script>
function myaccountmode(value) {

 if(value=="Paid Plan"){
	document.getElementById("charges").value = "Upgrade Charges Rs.<?php echo 99;?>";	
	}else if(value=="Plus Plan"){
    document.getElementById("charges").value = "Upgrade Charges Rs.<?php echo 199;?>";
	}else{
	document.getElementById("charges").value = "Upgrade Charges Rs.0";	
	}
}			  
</script>
   

</body></html>
HTML

Output:-

 

Another:-

The best way to achieve this is to use javascript.

<select id="dropdown">
  <option value="1.00">$1.00</option>
  <option value="12.43">$12.43</option>
  <option value="37.21">$37.21</option>
</select>

JavaScript:

var e = document.getElementById("dropdown");
var value = e.options[e.selectedIndex].value; // The value
var text = e.options[e.selectedIndex].text; // The text

Or jQuery:

$("#dropdown :selected").text(); // The text
$("#dropdown").val(); // The value

Leave a Reply

Your email address will not be published. Required fields are marked *