How to enable a button

P

** PeDeMo **

Hi,

I have a list where people can browse with PREVIOUS en NEXT-buttons. Bu at
the end of the list the NEXT-button is showed but obviously there are no
more items in that list. So I want something to do with this button so that
the people can see that there are no more items i.e. enabling of hiding that
NEXT-button. How can I do this so that it work in Javascript?
 
L

Lasse Reichstein Nielsen

** PeDeMo ** said:
I have a list where people can browse with PREVIOUS en NEXT-buttons. Bu at
the end of the list the NEXT-button is showed but obviously there are no
more items in that list. So I want something to do with this button so that
the people can see that there are no more items i.e. enabling of hiding that
NEXT-button. How can I do this so that it work in Javascript?

Try something like this:

var nextButton = document.getElementById("idOfNextButton");
// or some other way to get a hold of the next button

if (thisIsTheLastEntry()) {
nextButton.disabled = true;
nextButton.style.color = "gray";
} else {
nextButton.disabled = false;
nextButton.style.color = "";
}

/L
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top