I made a small modification to your markup that reflects the usual approach to this type of problem.
<div class="boxes">
<div>F</div>
<div>E</div>
<div>W</div>
<div class="active">L</div>
<div>X</div>
</div>
<p><button id="prev">Prev</button></p>
<p><button id="next">Next</button></p>
Pay attention to the container .boxesaround all of our items div. Also, note that we are no longer using it id, but rather a class ( .active) that will track our current location.
$("p").on("click", "#prev, #next", function(e){
var active = $(".active").removeClass("active");
active.length
? $(this).prop("id") === "prev"
? active.prev().addClass("active")
: active.next().addClass("active")
: $(".boxes :first-child").addClass("active");
$("#prev").toggle( !$(".active").is(":first-child") );
$("#next").toggle( !$(".active").is(":last-child") );
}).find("#prev").trigger("click");
Fiddle: http://jsfiddle.net/txpj2/2/