Playing with JavaScript, I have a search function which gets information from a database and then uses JavaScript to add the elements to my site in a box with a cross near the element. I am trying to make it so that when the user presses the X, near the element, they can remove it, if they made a mistake.
$('#addButton').on('click', function(event) {
var searchedValue = $('#search_term').val();
var divHolder = $('.selectedStuff');
$("<div>" + searchedValue + "</div>").css({
'background-color': 'yellow',
'width': '700px',
'margin-top': '10px',
'border-style': 'solid',
'border-color': '#0000ff'
}).appendTo(divHolder);
So, I tried certain methods, but I cant seem to get it to work. I have commented out the bit. Again, it's just when the user clicks on the X that element will be deleted.