[英]Changing icon unicode on element click
I have a form with one two inputs. 我有一个带有一两个输入的表格。 One of them is for text input and the another one is for submit, like a button.
其中一个用于文本输入,另一个用于提交,如按钮。 I added an icon in that submit one and I want to change it on click.
我在该提交图标中添加了一个图标,我想在单击时进行更改。
<input class="searchBtn" id="submit" name="submit" type="submit" value="">
$(document).ready(function() {
'use strict';
$(".searchInput").on("click", function () {
$(".searchBtn").attr("value", "")
})
})
The first icon works fine with that unicode value, but when I click it shows 
, not the icon for which that is the unicode. 第一个图标与该unicode值配合正常,但是当我单击它时,它会显示

,而不是该图标为unicode的图标。
Here's the solution (use the sequence \\u\u003c/code> to escape):
解决方法如下(使用序列
\\u\u003c/code>进行转义):
$(document).ready(function() { 'use strict'; $(".search-btn").on("click", evt => { $(evt.target).attr("value", "\"); }) })
@charset "UTF-8"; .search-btn { font-family: "FontAwesome"; }
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <input class="search-btn" id="submit" name="submit" type="submit" value="">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.