1

I need some help about this jQuery problem. I need something like this:

http://pastebin.com/vV5KEQfM

What I need Previous and Next buttons that works!

The problem is not the code for buttons. I found this for buttons:

$("#next").click(function() {
    $("#selectField").val($("#selectField > option:selected").next().val());
})

$("#prev").click(function() {
    $("#selectField").val($("#selectField > option:selected").prev().val());
})

It woks but it won't show content of DIV just changing the option in select menu..

1 Answer 1

0

Just changing the value using .val() doesn't trigger the change event. You need to trigger it manually using $('#selectField').change().

This should work:

$("#next").click(function() {
    $("#selectField").val($("#selectField > option:selected").next().val());
    $('#selectField').change();
});

$("#prev").click(function() {
    $("#selectField").val($("#selectField > option:selected").prev().val());
    $('#selectField').change();
});
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.