I need to extend a 14/2 WG wire a few feet. To do this I want to add the extra wire using a junction box. The problem is that I can't get a good angle to nail the junction box down so I was wondering if using Liquid Nails would be against code?
Article 314.23(B) of the National Electrical Code, says that the enclosure must be rigidly supported.
(B) Structural Mounting An enclosure supported from a structural member of a building or from grade shall be rigidly supported either directly or by using a metal, polymeric, or wood brace.
Whether or not liquid nails would meet this criteria may be up to interpretation, so it's best to check with your local inspector to determine if they'd allow it.
The other (better) option, would be to use an old work box. Which is allowed by subsection C of the same section.
(C) Mounting in Finished Surfaces. An enclosure mounted in a finished surface shall be rigidly secured thereto by clamps, anchors, or fittings identified for the application.