我想为必填字段添加一个红色星号。到目前为止,我已经尝试使用此方法:
.required-field::before {
content: "*";
color: red;
float: right;
}Run Code Online (Sandbox Code Playgroud)
<form id="nonUsSafety" method="post">
<div class="divTable">
<div class="divTableBody">
<div class="divTableRow">
<div class="divTableCell required-field">Status:</div>
<div class="divTableCell"><input type="text" id="statusNonUs" value="${statusNonUs}"></div>
</div>
<div class="divTableRow">
<div class="divTableCell required-field">Issued By:</div>
<div class="divTableCell"><input type="text" id="issuedBy" value="${issuedBy}"></div>
</div>
</div>
</div>
</form>Run Code Online (Sandbox Code Playgroud)
但是问题在于,它总是使星号偏右。我希望它紧靠在文本“状态:”和“发行人:”旁边。我尝试删除float属性,但随后将红色星号放在文本前面。
这是一个jsfiddle,显示了包括CSS样式在内的所有内容。
我正在编写一个迭代一个集合的函数,并找到其中最常见的项目.
以下是我到目前为止获取值并添加它们在集合中出现的次数.我将值作为键放在地图中,并将其显示为其值的次数.
fun mostCommon(input: Collection<Int>): Set<Int> {
var newMap: MutableMap<Int, Int> = HashMap()
for (item in input) {
if (newMap.containsKey(item)) {
//TODO: add 1 to value if key is found
}else {
newMap.put(item, 1)
}
}
return emptySet()
}
Run Code Online (Sandbox Code Playgroud)
如果密钥已存在,我无法找到将值加1的方法.
我试过这样做:
newMap[item] +=1
Run Code Online (Sandbox Code Playgroud)
但我得到一个关于plusAssign(1)的错误,不允许在Nullable接收器上.
我想使用jQuery通过箭头键移动IMG.我不知道如何在文档上使用方法.我不知道是否在switch语句的方法末尾使用括号.
<html>
<head>
<script type="text/javascript" src="jquery-3.3.1.min.js"></script>
<script>
function moveIMG(event) {
var x = event.keyCode;
switch(x) {
case 37:
doLeft;
break;
case 38:
doTop;
break;
case 39:
doRight;
break;
case 40:
doBottom;
break;
}
}
function doTop() {
$("div").animate({top: '+=100px'},1200);
}
function doBottom() {
$("div").animate({bottom: '+=100px'},1200);
}
function doLeft() {
$("div").animate({left: '+=100px'},1200);
}
function doRight() {
$("div").animate({right: '+=100px'},1200);
}
</script>
</head>
<body onkeydown="myFunction(event)">
<div id="animateimg" style="position:absolute"><img src="black.png"></div>
<script>$(document).moveIMG()</script> <!-- I think in this place the problem -->
</body>
</html>
Run Code Online (Sandbox Code Playgroud) 让我们以以下为例。
@Autowired
@MockBean
private Foo foobar;
Run Code Online (Sandbox Code Playgroud)
Spring Context是否Foo先加载类,然后再应用模拟?还是@Mockbean以某种方式检测到该获取,然后Spring创建并应用该模拟,而不是将类加载Foo到Spring Context中。我怀疑是后者,但我想确认一下。
我有一个页面,它从文件中读取并根据在搜索框中输入的内容显示过滤结果.当我单击重置按钮时,它会清除我想要的搜索框,但我也希望清除过滤后的结果.如果我取消注释下面的呼叫,此时被评论 - 它可以工作,但搜索框不清除.
HTML:
<form>
<ul data-bind="foreach:properties">
<li><input data-bind="attr:{placeholder:id},event:{change:$root.onInputChange}, value:value, valueUpdate: 'afterkeydown'" /></li>
</ul>
<input type="reset" value="Reset"/>
<!--<input type="reset" value="Reset" data-bind="click:$root.onclick"/>-->
</form>
<p></p>
<table data-bind="foreach:itemsFiltered">
<tr data-bind="foreach:$parent.formatItem($data)">
<td data-bind="text:value"></td>
</tr>
</table>
Run Code Online (Sandbox Code Playgroud)
我需要搜索框和过滤结果来清除.
我的 html 输入数字值在我的 JS 代码中无法识别,它会提醒什么都没有。如果我想制作另一个代码,也会发生同样的事情
var age = document.getElementById("ent").value;
document.getElementById("press").onclick = function() {
alert(age);
}Run Code Online (Sandbox Code Playgroud)
<input type="number" id="ent">
<button id="press">seed</button>Run Code Online (Sandbox Code Playgroud)
javascript ×4
html ×3
css ×2
jquery ×2
hashmap ×1
html5 ×1
kotlin ×1
reset ×1
spring ×1
spring-boot ×1
spring-test ×1