how to call a bootstarp class into javascript using (document.get element by class) : how to call a bootstrap class into java script using HTML DOM getElementsByClassName() Method

for eg:-

    document.getElementByClass=("has-error");

I need a the text box to turn into green if the data is valid and to red if the data is in valid using boot strap class 

**has-success and has-error**