javascript - How to check if a value exist in select box -


is there method other running loop check if value exists in select box using javascript?

i looking document.getelementbyid('selbox').valueexists('myval');

you can't extend methods select-element has. there not solution without function check existence of value in select.

a "solution" without loop following...

function selecthasvalue(select, value) {     obj = document.getelementbyid(select);      if (obj !== null) {         return (obj.innerhtml.indexof('value="' + value + '"') > -1);     } else {         return false;     } } 

Comments

Popular posts from this blog

silverlight - Applying a style to ItemContainerStyle in C# -

c# - NullReferenceException in MySqlClient.NativeDriver -

php - Updating recent updates - Problem in procedure - Any other approach? -