7. let's focus(). Help please


#1

$(document).ready(function(){
    $("#input").focus(function(){
        $(this).css("outline-color","#FF0000");
    });
});

#2

Hi pascac,

What error are you getting? And please give exercise link. Without the exercise, I can guess that:

$("#input").focus(function(){

should be:

$("input").focus(function(){

because you want the <input> element, not the element with input id.


#3

ok, thx. But it doesn't work to


#4

Hi pascac,

For this exercise, when I removed the # as I said before and then in the full screen result focused in the input field, the outline to it was red in color and I got the green tick as well.

What browser and OS are you using?


#5

try the code below:

$(document).ready(function(){
  $("#input").focus(function(){
    $(this).css("outline","2px solid #f00");
  });
});