I have already seen the previous question asked for this problem. But i don't want to replace the textbox with same id.
When Timepicker is selected in dropdown timepicker
should enable in textbox(which is run as expected)
When dropdown value changes to Textbox then the textbox should treated as simple text
function ChangeType(control){
if(control.value == "Time"){
$("#txtInput").timepicker();
}
else {
$("#txtInput").val('');
// I want to remove timepicker from textbox
}
}
.input-group-addon:after{
content:'\0777'
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-timepicker/0.5.2/css/bootstrap-timepicker.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-timepicker/0.5.2/js/bootstrap-timepicker.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.3.2/css/bootstrap.min.css" rel="stylesheet"/>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<select name="" id="cmbList" onchange="ChangeType(this)">
<option value="Text">Textbox</option>
<option value="Time">Timepicker</option>
</select>
<br><br><br>
<div class="input-group bootstrap-timepicker timepicker">
<input id="txtInput" type="text" class="form-control">
<span class="input-group-addon"><i class="glyphicon glyphicon-time"></i></span>
</div>