Our Black Friday Sale has been extended!  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 is a Chicago digital marketing agency with over 25 years of experience helping clients nationwide. We have an in-house team of marketers and creatives ready to improve your business’s marketing operations.

Share On:


Leave a Comment

Your email address will not be published.

Copyright © 2023, 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