The JK Flip-Flop (JK FF) is functionally identical to the SR Flip-Flop (SR FF), except that it defines a toggle function for the case when both S and R are asserted. It is easily built from an SR FF:
 +--------------------------+          clk J K |   Y
 | +---+                    |            _ ----+------
 +-|   |  +-----------+     |          _/_ 0 0 | rest
J--|AND|--|S      Y(H)|---+----Y(H)    _/_ 1 0 |   1
   +---+  |           |   | |          _/_ 0 1 |   0
clk-------|>   SR     |   | |          _/  1 1 |toggle 
          |    FF     |   | |
   +---+  |           |   | |
K--|AND|--|R      Y(L)|o----+--Y(L)
 +-|   |  +-----------+   |
 | +---+                  |
 +------------------------+

Be sure to see bistable multivibrator, SR Latch, and SR Flip-Flop for complete details on how this component works.

J is obviously analogous to the S (set) input on the SR FF, and K is analogous to R (reset) on the SR FF. When both are asserted, however, the Flip-Flop "toggles", or complements, its current state. Thus if Y=1, and you assert J=K=1, then Y will become 0 on the next active clock edge, and vice versa if Y=0. The AND gates assure that the flip-flop will set only if it is currently reset, and it will reset only if it is currently set. Thus, the "11" input which was "bad" before can never reach the SR FF component above; it becomes transformed into either a set or reset command, as apropriate.

See also T Flip-Flop, counter.

Also JK-Flip-Flop.