Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Selectize focus() and blur() event functionality #1887

Unanswered
whitsey asked this question in Q&A
Discussion options

I have an existing select which I have just selectized.

I use Ajax which is triggered when an item in the select list is selected. $('#saleCatFilter').change();

When I select an item everything works as expected except when I am trying to apply a blur() or focus() event.

	$saleCatFilter = $("#saleCatFilter").selectize({
		plugins: ['remove_button'],
		placeholder: 'All Sale Categories',
		closeAfterSelect: true,
		onChange: function(value) {
			$saleCatFilter.blur();
		},
		onItemRemove: function(value) {
			$saleCatFilter.close();
			$saleCatFilter.focus();
		}
	});
  1. When I select an item with closeAfterSelect: true, the focus remains inside the element which means that a new click in the element does not trigger the dropdown. Therefore, I added onChange: blur() to try and remove the focus but the focus remains.

  2. When I remove all items from the list, the select field height collapses with NO placeholder displayed. It's not until I click back into the field that the field returns to its original height and the placeholder appears again. I tried adding onItemRemove: focus() to reset the placeholder but that is not working either.

https://jsfiddle.net/o7abkx85/1/

You must be logged in to vote

Replies: 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant

AltStyle によって変換されたページ (->オリジナル) /