Click here to Skip to main content
15,903,385 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Greetings,
I wish to replace the value retrieve from database in a textbox for data update. However, my codes cannot work properly and I don't know the reason. Can some one help me to look on it? Appreciate the help very much.

What I have tried:

<label for="Emp_Type" class="col-sm-2 col-sm-push-1 control-label">Employee Type <span> * </span> </label>
<div class="col-sm-2" style="padding-left:8%;width:250px">
<select class="form-control" name="type" id="type" onChange="changetextbox()"/>
</select>
</div>

<input type="text" class="form-control" style="width:120px;padding-left:1%" id="pay" name="pay" value="<?php echo $payType?>" readonly required>


function changetextbox()
{
if (document.getElementById("type").value === "Full Time")
{
//replace value of Pay Type
var str = document.getElementById("pay").value = "";
var res = str.replace("", "Hourly");
document.getElementById("pay").value = res;
}
}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900