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

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -