td : focus{ border:2px solid #C00; background:none; background-color:#069; } 

    2 answers 2

    Right and says - "I refuse to work"? :-)

    But seriously, the pseudo-class: focus applies to elements that can receive focus ( <a>, <input>, <select> и <textarea> )

    For td try: hover

    • hover also refuses. - Radik Kamalov
    • Radik, and with a hover you also put a bunch of spaces between the element, the colon and the pseudo-class, right? - Sh4dow
    • Thank! Only it turns out it does not fit. I need to press the blackout, and leave it so even after the focus is removed from the element. - Radik Kamalov
     td:focus{ border: #C00 2px solid; background: #069; } 

    I need to press the blackout, and leave it so even after the focus is removed from the element.

    Jquery:

     $('td').click(function() { $(this).toggleClass('clicked'); }); 

    And write styles for td.clicked ;

    • Added "on click". - Sh4dow 9:39 pm
    • Thank! And is there such a function that if you clicked on another td, then from the previous class is automatically deleted? Or handles everything to prescribe ?? - Radik Kamalov
    • similarly: $ ('td'). click (function () {$ ('td'). removeClass ('clicked'); $ (this). addClass ('clicked');}); - mantigatos
    • thank! I meant about removeClass, when I said “handle everything with handles,” I just thought there might be some kind of automatic function. - Radik Kamalov
    • one
      Vashche people got lazy)) Handles - this is to catch all td, filter by regular class by class, replace class, and then assign current) jquery corrupts, however. - Sh4dow