So, I have a "custom" searchbar that fetches some html code and displays it under the input form. The incoming html is in this form:
And when I type in "ba" I get this result in the searchbar:
So, basically, I want to turn "33 | balloon Rides Daily (1)" into "balloon Rides Daily" How can I do this? thanks!
Full code:
<form>
Search:
<input type="text" id="searchbar">
<br>
</form>
<div id="result"></div>
<script>
var term;
$('#searchbar')
.bind('keyup', function(e) {
term = $(this).val();
document.getElementById("result").innerHTML = "";
console.log(term);
getTags();
});
function getTags() {
$.get("myaspscript", {
needle: term
}, function(data, status) {
tags = data.split(", ");
$(result).html(data);
$($(result).find('ol').get().reverse()).each(function() {
$(this).replaceWith($('<ul>' + $(this).html() + '</ul>'))
})
});
}
</script>
</body>
EDIT
How the html looks: http://jsfiddle.net/gk2ud9fL/2/