The value must be retrived from javascript alert to textbox without losing runat="server". code as follow
<script type="text/javascript">
$(".btn-group > button.btn").on("click", function () {
var name = this.innerHTML; ;
$('#TextBox1').html(name);
});
</script>
<script type="text/javascript">
$(".btn-group > button.btn").on("click", function () {
var name = this.innerHTML; ;
// Use `val()` instead of html
// Use `ClientID ` to use textbox generated id in javascript
$('#<%= TextBox1.ClientID%>').val(name);
});
</script>
$('#TextBox1').val(name);
使用value方法设置文本框的内容
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.