A support mechanism includes a connecting portion and a support member. The support member includes a main body rotatably connected to the connecting portion and a support portion extending from one end of the main body. A first magnet is positioned on the connecting portion. A second magnet is positioned on the support member. The magnetic force generated between the first magnet and the second magnet rotates the support member relative to the connecting portion. An electronic device using the same is also provided.