I've onclick jquery code that doesn't give any response even with an error!
I don't know why, but here's my jQuery Code:
/* This Is working correctly */
$(".add-blog .blog-add-form .add-article .input-group select").on("change", function() {
var tagsUl = '<li class="' + $(this).val() + '"><i class="fa fa-fw fa-times" aria-hidden="true"></i> ' + $(".add-blog .blog-add-form .add-article .input-group select option:selected").text() + '</li>';
$(".add-blog .blog-add-form .add-article .input-group ul").append($(tagsUl));
$(".add-blog .blog-add-form .add-article .input-group select option:selected").remove();
});
/* This isn't working correctly */
$(".add-blog .blog-add-form .add-article .input-group ul li i").on("click", function() {
var optionValue = $(this).parent().attr("class"),
optionText = $(this).parent().text(),
appendedOption = "<option value='" + $(optionValue) + "'>" + $(optionText) + "</option>";
$(this).parent().parent().parent().children("select").append($(appendedOption));
$(this).parent().remove();
});
I'm 100% sure that this element selector exist
when I open the css element inspector, select the element and put the same element selector, it shows that this element is the selected one.
anyway, here's my HTML Code:
<article class='add-blog'>
<div class='blog-add-form'>
<div class='add-article'>
<form method='POST' action='example.php' class='form-horizontal'>
<div class='input-group'>
<select></select>
<ul class='list-unstyled selected-ul'>
<li class='0'><i class='fa fa-fw fa-times'></i> Anytext</li>
</ul>
</div>
</form>
</div>
</div>
</article>
[<>]toolbar button; here's how to do one).