Changed it now to show 'wrong' instead and it works perfectly now! Thank you so much for the help and quick responses!
To help other people who might need this in the future I will post the code below.
<div style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size:70px; color:#FF0000; font-weight:bold;" id="wrong">WRONG</div>
<script type="text/javascript">
<!--
//this bit is needed to show the feedback display for long enough, otherwise it loads the display and hides it immediatly after
document.getElementById("wrong").style.display = "none";
// Filter function IA01 Compatible
// Filter needs to respond when wrong response is given
// Ignore left-hand option (1) in stimuli 9,10,11,12,13,14,15,16
// If not left-hand then return 0 (go on to next stimulus as if there was no filter)
// Ignore right-hand option (2) in other stimuli
// IA101 needs to be replaced for other questions
//create array with trials where left-hand response is desired
var IA101 = [1,2,3,4,5,6,7,8]
//Create function to show feedback for limited time and hide, feedback = text element with id 'wrong'
function showContent()
{
var content = document.getElementById("wrong");
// restore the normal display mode
content.style.display = "";
/// start the timer
window.setTimeout(function()
{
// Hide
content.style.display = "none";
}, 1000); // 1 second
}
function selFilter(item, option)
{
//indexOf returns -1 if the number is not found and something other than -1 i it is found
//if the 'item' cannot be found in the variable IA01, so it is a trial where a right-hand response is desired
//and the response was left-handed (option1)
if ( (IA101.indexOf(item) == -1) && (option == 1))
{
// Show feedback and ignore answer
showContent()
return -2;
}
//if the 'item' can be found in the variable IA01, so it is a trial where a left-hand response is desired
//and the response was right-handed (option2)
else if ( (IA101.indexOf(item) != -1) && (option == 2))
{
// Show feedback and ignore answer
showContent ()
return -2;
}
//otherwise continue with next trial
else
{
return 0;
}
}
SoSciTools.attachEvent(window, "load", function() {
assignmentIA01.setCallbackSelect(selFilter);
});
// -->
</script>