Toggle Nav
My Cart 0

How to handle long text of dropdown in IOS

Posted in: Javascript

How to handle long text of dropdown in IOS

You can manage long text of select options by just adding empty optgroup at end of the select list. You can achieve this by adding below javascript script.

jQuery( document ).ready(function() {
	if (navigator.userAgent.match(/(iPod|iPhone|iPad)/)) {
		var selects = document.querySelectorAll("select");
		for (var i = 0; i < selects.length; i++ ){
			selects[i].appendChild(document.createElement("optgroup"));
		}
	}
});

June 14, 2018
Did you like this post?
0
0