我正在测试输入上的:focus ,以便在选中时将其边框更改为绿色。显然,它似乎不起作用。我尝试检查拼写错误,但没有找到任何错别字。 (我是发展世界的新手) 我正在尝试做一个待办事项应用程序,该应用程序的顶部具有一个输入区域,用于添加更多任务。我的目标是使该区域在选中时具有绿色边框,但似乎不起作用。
$("ul").on("click","li",function(){
$(this).toggleClass("completed");
});
$("ul").on("click","span",function(event){
$(this).parent().fadeOut(500,function(){
$(this).remove();
});
event.stopPropagation();
});
$("input[type='text']").keypress(function(event){
if (event.which == 13) {
let toDo = $(this).val();
$(this).val("");
$("ul").append("<li><span>X</span> " + toDo + "</li>");
}
});
#container {
border: 2px solid gray;
width: 360px;
margin: 0 auto;
border: none;
background-color: #f7f7f7;
}
ul{
list-style: none;
padding-left: 0px;
}
.completed {
color: gray;
text-decoration: line-through;
}
h1 {
background-color: #2980b9;
color: white;
margin: 0;
padding: 10px 20px;
font-size: 24px;
font-weight: normal;
text-transform: uppercase;
}
li {
height: 40px;
line-height: 40px;
color: #666666;
background-color: #fff;
}
li:nth-child(2n) {
background-color: #f7f7f7;
}
input {
font-size: 18px;
color: #2980b9;
width: 315.89px;
padding: 13px 20px 13px 20px;
}
input:focus() {
background-color: #fff;
border: 3px solid #0fff2d;
outline: none;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<html>
<body>
<div id="container">
<h1>To-Do List</h1>
<input type="text" placeholder="Add New Todo">
<ul>
<li><span class="delete">X</span> Go To Potions Class</li>
<li><span class="delete">X</span> Buy New Robes</li>
<li><span class="delete">X</span> Visit Hagrid</li>
</ul>
</div>
</body>
</html>
答案 0 :(得分:0)
在CSS中,您切勿添加def is_same(self, obj):
excluded_keys = 'timestamp', 'creator_id' # creater_id is one foreign key ins table
return _is_same(self, obj, excluded_keys)
def _is_same(obj1, obj2, excluded_keys):
d1, d2 = obj1.__dict__, obj2.__dict__
for k, v in d1.items():
# print('check key: ' + k)
if k in excluded_keys or k in ['_state', '_django_cleanup_original_cache']: # _state make difference so automatically exclude it
# print(k + ' is in excluded keys')
continue
if v != d2[k]:
# print('value in not equal in second object')
return False
else:
# print('it is same')
continue
# print('all keys checked, so both object is same')
return True
:
()
$("ul").on("click","li",function(){
$(this).toggleClass("completed");
});
$("ul").on("click","span",function(event){
$(this).parent().fadeOut(500,function(){
$(this).remove();
});
event.stopPropagation();
});
$("input[type='text']").keypress(function(event){
if (event.which == 13) {
let toDo = $(this).val();
$(this).val("");
$("ul").append("<li><span>X</span> " + toDo + "</li>");
}
});
#container {
border: 2px solid gray;
width: 360px;
margin: 0 auto;
border: none;
background-color: #f7f7f7;
}
ul{
list-style: none;
padding-left: 0px;
}
.completed {
color: gray;
text-decoration: line-through;
}
h1 {
background-color: #2980b9;
color: white;
margin: 0;
padding: 10px 20px;
font-size: 24px;
font-weight: normal;
text-transform: uppercase;
}
li {
height: 40px;
line-height: 40px;
color: #666666;
background-color: #fff;
}
li:nth-child(2n) {
background-color: #f7f7f7;
}
input {
font-size: 18px;
color: #2980b9;
width: 315.89px;
padding: 13px 20px 13px 20px;
}
input:focus {
background-color: #fff;
border: 3px solid #0fff2d;
outline: none;
}