i want to put a background image in a div and it works well with the classname but not with the keyword “this”. how is this possible and what are the solutions?
$('#txtElement1').on('keypress', () =>{
if(event.code == "Enter"){
const invoerTextveld = $('#txtElement1').val();
$('ul').append('<div class="outputCheck"></div> <li class="liText">' + invoerTextveld + '</li>' + '<hr class="hr">');
$('.outputCheck').on('click', () =>{
console.log(this)
$(this).css('background-image', 'url(images/Group4.png)');
})
}
})