i have following HTML element:-
<a href="http://localhost/wordpress/post-2/#more-4" class="more-link">
I tried to add a button before span
(put span
between button) with jQuery before function:
<script>
$(document).ready(function() {
$("a.more-link").before("<button class=\"btn btn-default\">");
});
</script>
The output is:
<button class="btn btn-default"></button>
<a href="http://localhost/wordpress/post-2/#more-4" class="more-link">
<span aria-label="Continue reading post 2">(more…)</span>
</a>
The following </button>
tag is added automatically! Why? Can I not add a span
between button tags? How can I prevent that or is there any way to add span between button tags?
$(document).ready(function() {
$("a.more-link").before("<button class=\"btn btn-default\">");
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button class="btn btn-default"></button>
<a href="http://localhost/wordpress/post-2/#more-4" class="more-link">
<span aria-label="Continue reading post 2">(more…)</span>
</a>