Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I originally was using the option to disable the spinner widget, but I don't want to use that, because it causes the value of the widget to be lost when the form is submitted. What I am looking for is to set the widget to readOnly.

When I set it to read only, it correctly makes it so the user cannot type in the field, but unfortunately they can still click the up and down buttons. I am wanting to know if there is a way to either disable or hide the spinner buttons without affecting the text part of the widget, so I can later re-enable or show those buttons.

Thanks in advance! -David

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

To hide the spinner controls, run this:

$('.ui-spinner a.ui-spinner-button').css('display','none');

To make them reappear run this:

$('.ui-spinner a.ui-spinner-button').css('display','block');

Change the selector value to fit your document structure.

share|improve this answer
 
Thanks, this worked for me. I would have preferred to have the buttons grayed out and disabled, but hidden works well too. This is the solution I am using. Since I am in a function where I have a handle to the input, I used: jQuery(this).siblings('.ui-spinner-button').css('display', 'none'); –  David Whiteman Nov 4 '13 at 22:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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