Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clear value on blur when no item is selected #74

Open
liglesiash opened this issue Jan 31, 2020 · 1 comment
Open

Clear value on blur when no item is selected #74

liglesiash opened this issue Jan 31, 2020 · 1 comment

Comments

@liglesiash
Copy link

Hi.
When I filter an editable-select and select no item, but a previous item was selected, I 'd like to clear the value (on blur, hide or any where else). Could any one help me?

@AmanKhan9
Copy link

AmanKhan9 commented Sep 9, 2020

How about using some brute force :

var comboRef = document.getElementById('yourcomboid');
var isMatch = false;
var liElems = comboRef .parentNode.getElementsByTagName("li");
for(var i=0;i<liElems.length;i++){
if(liElems[i].value==comboRef .value){
isMatch = true;
break;
}
}
if(!isMatch) comboRef .value='';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants