Here is my code:
function removeWrongClass(el){
el.removeClass('wrong');
}
$(".ask_q_title_input").on('focus', removeWrongClass($(this)));
.wrong{
background:red;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input class="ask_q_title_input wrong" type="text" />
Expected behavior is removing that red background color (which is because of .wrong
class) from the input when you focus on the input. But it doesn't happen. What's wrong? And how can I fix it?