O'Reilly logo

jQuery and JavaScript Phrasebook by Brad Dayley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Refreshing Form Elements

var mySelect = $("#mySelect"); mySelect [0].selectedIndex = 1; mySelect.selectmenu("refresh"); $("#myCheckbox").prop("checked",true).checkboxradio("refresh"); $("#myRadio").prop("checked",true).checkboxradio("refresh"); $("#mySlider").val(100).slider("refresh");

When programmatically changing items in a form, such as adding options to a select, you need to call the refresh function on the item. Following are some examples of adjusting form elements using jQuery and then refreshing them.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required