我正在处理显示错误消息的简单表单,我的问题是当我试图在警报消息上添加图标时,图标不显示。我使用feathericons来生成图标。
我做了一个简单的代码片段,图标正常显示,但当我使用jquery显示它时,它不起作用。
希望你能帮我。
谢谢。
$(document).ready(function(){
feather.replace();
$('button').click(function(){
$('.alert').html('<i data-feather="activity"></i>');
});
});<script src="https://unpkg.com/feather-icons@4.10.0/dist/feather.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<button>show Icon</button>
<div class="alert"></div>
<hr>
<i data-feather="home"></i>
<i data-feather="alert-circle"></i>
<i data-feather="globe"></i>
发布于 2019-01-02 14:04:20
尝尝这个。
<script src="https://unpkg.com/feather-icons@4.10.0/dist/feather.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<button>show Icon</button>
<div class="alert"></div>
<hr>
<i data-feather="home"></i>
<i data-feather="alert-circle"></i>
<i data-feather="globe"></i>
<script>
$(document).ready(function(){
feather.replace();
$('button').click(function(){
$('.alert').html('<i data-feather="activity"></i>');
feather.replace();
});
});
</script>https://stackoverflow.com/questions/54001661
复制相似问题