Our Black Friday Sale is here!  View Sale

Select list not centered after AJAX update

Overlapping colored triangles

If you have a <select> dropdown list whose contents you are clearing out and updating via a jQuery AJAX call, you may find that Internet Explorer is not recalculating its layout, and so what was once centered now looks left-aligned. A quick solution is to force IE to redraw by adding trivial whitespace after your <select>:

// clear out and re-populate dropdown
	// ... ajax options ...
	success: function(data) {
			$.each(data, function() {
				// .. update your <select> list
			// force redraw.
			$("#my-dropdown").after(' ');

About the Author:



VisionFriendly.com has been building successful websites for over 20 years and covers all areas of website design, development and marketing with creative custom web designs and a robust in-house team of programmers to get your web marketing to work exactly the way you need it to.

Share On:


Leave a Comment

Your email address will not be published.

Copyright © 2022, All Rights Reserved
Tri Colored Triangles
Scroll to Top

Take your business to the

Next Level!

Visionfriendly.com has the right team to make your business stand out from other professional websites.

Ready For Takeoff?

A Completely Customized
Digital Marketing Experience

  • We'll be in touch within one business day to discuss your goals and create a personalized plan that fits both you and your business.

  • This field is for validation purposes and should be left unchanged.

Let’s start a Conversation