Sorry folks, still being thick on JQuery. Had great help creating a selectable ul li list like this
$(document).ready(function(){
$('.selectoption li').not(':first').hide();
$('.prev, .next').click(function() {
// Determine the direction
var dir = $(this).hasClass('prev') ? 'prev' : 'next';
// Get the li that is currently visible
var current = $('.selectoption li:visible');
// Get the element that should be shown next according to direction
var next = dir == 'prev' ? current.prev('li') : current.next('li');
// If there's no more in that direction, select first/last
if(next.size() == 0) {
next = dir == 'prev' ? $('.selectoption li:first') : $('.selectoption li:first');
}
// Hide them all..
$('.selectoption li').hide();
// And show the new one
next.show();
return false;
});
});
But how can I then append the value of the selected li into a text field so it can be used within a form - cannot use Ajax etc. on this occassion as the li list is outside the form.
Also, if I have say 3 or 4 of these ul li's on a page how do I wrap the above code in a way that the next / prev button only wotk with the ul li that they apply to.
Thanks in advance