Disable Prev, Next, Done Buttons for Samsung Internet on Select Dropdowns

When you have a select element on your website, you may notice that some browsers display “prev”, “next”, or “done” buttons when you click on the select element. These buttons are part of the browser’s autofill feature and can be useful for some users, but they can also be distracting or unwanted for others.

If you want to disable these buttons or make them disappear after an option is selected, you can use JavaScript or jQuery to unfocus the select element. Unfocusing the select element will remove the focus from it, which will cause the browser to hide any autofill-related buttons.

In this article, we’ll show you how to unfocus a select element after an option is selected using JavaScript and jQuery.

Unfocusing a Select Element with JavaScript

To unfocus a select element with JavaScript, you can use the “blur()” method. The “blur()” method removes the focus from an element, which will cause the browser to hide any related buttons.

Here’s an example:

				
					<select id="mySelect" onchange="handleSelectChange()">
  <option value="option1">Option 1</option>
  <option value="option2">Option 2</option>
  <option value="option3">Option 3</option>
</select>

				
			

In the example above, we have a select element with an ID of “mySelect”. We also have an “onchange” event that calls a function called “handleSelectChange()” when an option is selected.

				
					function handleSelectChange() {
  var selectElement = document.getElementById("mySelect");
  selectElement.blur();
}

				
			

In the “handleSelectChange()” function, we first get a reference to the select element using its ID. We then call the “blur()” method on the select element to unfocus it.

By calling the “blur()” method, the select element will lose focus and any associated “prev”, “next”, “done” buttons should disappear.

Unfocusing a Select Element with jQuery

To unfocus a select element with jQuery, you can use the “$().blur()” method. The “$().blur()” method removes the focus from an element, which will cause the browser to hide any related buttons.

Here’s an example:

				
					<select id="mySelect">
  <option value="option1">Option 1</option>
  <option value="option2">Option 2</option>
  <option value="option3">Option 3</option>
</select>

				
			

In the example above, we have a select element with an ID of “mySelect”.

				
					$(document).ready(function() {
  $('#mySelect').change(function() {
    $(this).blur();
  });
});

				
			

In the jQuery code above, we use the “$()” function to select the select element with the ID of “mySelect”. We then attach a “change” event listener to the select element using the “.change()” method. When an option is selected, the function passed to “.change()” is executed.

In this case, the function simply calls the “$().blur()” method on the select element using “$(this)” to reference the current element. By calling the “$().blur()” method, the select element will lose focus and any associated “prev”, “next”, “done” buttons should disappear.

Conclusion

After spending many hours trying to figure out this specific issue for Samsung devices running the Samsung Internet app internet browser, this was the solution that got things working.

While the Prev, Next, and Done buttons still appear, the user does not actually have to click “Done” to proceed filling out a form, which saves clicks and streamlines the user experience.

We hope this article was informative and helpful for you!