这是视图代码:
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<!-- Load JQuery UI -->
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<script type="text/javascript">
$( function() {
$("#input").autocomplete({
source: function(req, add){
$.ajax({
url: '<?php echo base_url(); ?>test/ac2',
dataType: 'json',
type: 'POST',
//data: req,
data: 'input='+req,
success: function(data){
if(data.response =='true'){
add(data.message);
}
}
});
},
minLength: 2,
select: function(event, ui){
$(this).end().val(ui.item.value);
}
});
});
</script>
</head>
<?php
echo form_open();
echo form_input('input', '', 'id="input"');
echo form_close();
?>
</html>
Run Code Online (Sandbox Code Playgroud)
和控制器代码:
class Test extends CI_Controller {
function index()
{
$this->load->view('vw/test_vw');
}
public …Run Code Online (Sandbox Code Playgroud) 我正在使用Bootstrap 浮动标签功能。参考 => https://github.com/tonystar/float-label-css
注意:我根据我的要求做了一些更改。
问题 :
1)当我们点击任何输入时,浮动标签工作正常。但是在浮动标签背景引导程序的表单输入边框中是可见的。
2)当验证发生时,下一个输入的浮动标签会中断,就像浮动标签在输入字段上方一样。我在<span id="error_*****" class="error"></span>外面使用<span class="has-float-label">
3)在不同浏览器中的外观如下。在 IE 和 Edge 中,默认应用浮动标签。IE,Edge 是否可以或任何解决方案?
我的情况的其他信息:
Windows 10 64 位
Firefox(版本 72.0.1)
Chrome(版本 79.0.3945.117)
Opera(版本 65.0.3467.78)
MS-Edge(版本 44.18362.449.0)
MS-IE(版本 11.535.18362.0)Forst Boot
=>.4 .1 被使用。
function trim(stringToTrim) {
return stringToTrim.replace(/^\s+|\s+$/g,"");
}
$(document).ready(function() {
$("#btn_contactus").click(function () {
//alert("hi");return false;
if ( trim($("#firstname").val()) == '' )
{
$("#error_firstname").html('Please enter First Name');
$("#error_firstname").show();
$("#firstname").val('').focus();
return false;
}
else
{
$("#error_firstname").hide();
}
if ( …Run Code Online (Sandbox Code Playgroud)