如何将glyphicons放入输入字段?我尝试了几种解决方案,但没有正常工作,"确定"的字形。并且"删除"无论如何都出现在输入之外。 HTML:
<div class="modal-body">
@using (Html.BeginForm("SetOneTimeDeliveryAddress", "Orders", FormMethod.Post, new { Name = "OneTimeDelivery", id = "OneTimeDelivery" }))
{
<div class="form-group">
<div>
<label>Nazwa:</label>
<div>@Html.TextBoxFor(Model => Model.NazwaPelna, new { Name = "NazwaPelna", id = "Nazwa", @class = "form-control" })</div>
</div>
</div>
JavaScript的:
},
highlight: function (element) {
$(element).closest('.form-group').removeClass('has-success').addClass('has-error');
$(element).closest('.form-group').find('[class^="glyphicon"]').remove();
$(element).closest('.form-group > div > div').append('<span class="glyphicon glyphicon-remove form-control-feedback" ' + 'aria-hidden = "true"' + ' id="statushigh">');
},
unhighlight: function (element) {
$(element).closest('.form-group').removeClass('has-error').addClass('has-success');
$(element).closest('.form-group').find('[class^="glyphicon"]').remove();
$(element).closest('.form-group > div > div').append('<span class="glyphicon glyphicon-ok form-control-feedback"' + ' aria-hidden="true" ' + 'id="statussun">');
},
success: function (element) {
$(element).closest('.form-group').addClass('valid').closest('.control-group').removeClass('error').addClass('success');
},
其效果: