0
我试图水平对齐input
和img
元素在特定的div
。我给了input
元素一个CSS属性display:block
,但我的Firebug显示其显示属性为none
。输入字段不显示
关于CSS
.block_feedback .field input {
color: #FFF;
width:375px;
height:17px; line-height:17px;
margin-left:15px; margin-top:6px;
display:block;
background-color:transparent;
border:0px;
font-family:Arial, Helvetica, sans-serif;
font-size:16px;
float:left;
}
.block_feedback .field img {
color:#F00;
width:27px;
height:27px; line-height:25px;
margin-left:405px; margin-top:0px;
display:block;
background-color:transparent;
border:0px;
font-family:Arial, Helvetica, sans-serif;
font-size:16px;
font-weight:bold;
font-weight:bold;
float:left;
}
HTML
<div class="field">
<input type="text" name="name" class="w_def_text" title="Name*" />
<img width="27" height="27" src="images/error.jpg" alt="Error">
</div>
萤火虫被示出作为
<input class="w_def_text" type="password" title="Password*" name="password" style="display: none;">jQuery1510542302776850034=Object { olddisplay="block"}
<img width="27" height="27" alt="Error" src="images/error.jpg" style="display: block;">
<span style="display: none;">Password*</span>jQuery1510542302776850034=Object { olddisplay="block"}
jQuery的
function init_fields() {
$('.w_def_text').each(function() {
var text = $(this).attr('title');
var html = '<span>' + text + '</span>';
$(this).parent().append(html);
if($(this).val() == '') {
$(this).hide();
$(this).next().show();
}
else {
$(this).css({'display' : 'block'});
$(this).next().hide();
}
});
$('.w_def_text').live('blur', function() {
if($(this).val() == '') {
$(this).hide();
$(this).next().show();
}
});
$('.w_def_text ~ span').live('click', function() {
$(this).hide();
$(this).prev().css({'display' : 'block'}).focus();
});
}
看起来好像jQuery隐藏它。分享你的JavaScript? – kojiro
这里的firebug示例中的jquery位似乎表明你已经在某个地方玩了一些JS,在背后使用css。 –
@Marc,但我不认为我的jQuery正在修改任何显示属性。 –