Can you put a tag, to be specific (ion icons) tag to an input type submit value?
I got these 2 tags and I need to combine them
JavaScript
x
3
1
<input type="submit" name="plus" value="" class="btn">
2
<ion-icon name="chevron-forward-outline"></ion-icon>
3
Like so, But to make it work.
JavaScript
1
2
1
<input type="submit" name="plus" value="<ion-icon name="chevron-forward-outline"></ion-icon>" class="btn">
2
Advertisement
Answer
Not with <input type='submit' ...>
, as HTML labels aren’t supported this way. From <input type="button">
MDN page:
Note: While
<input>
elements of type button are still perfectly valid HTML, the newer<button>
element is now the favored way to create buttons. Given that a<button>
’s label text is inserted between the opening and closing tags, you can include HTML in the label, even images.
As such, with the functionally-same <button>
you can have HTML labels:
JavaScript
1
5
1
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet"/>
2
<script src="https://unpkg.com/ionicons@5.1.2/dist/ionicons.js"></script>
3
<button type="submit" name="plus" value="" class="btn btn-primary">
4
<ion-icon name="chevron-forward-outline"></ion-icon>
5
</button>