javascript - Changing to an Error Class -


i need validate length of string in inputbox. if string invalid trigger onblur event. when event triggered, must turn label of object associated trigger red. however, there css class exist contains style, need change class class.
prefix value being passed in. here sample code.

var input = $(this).val(); var findlabel = document.getelementbyid`enter code here`(prefix+'findlabel'); if(input.length < min || input.length > max){     //alert check values testing    alert('value selected country '+selectedcountry+' must between '+min+' , '+max+' characters'); } 

example

<div class="value_s123" id="a1values123" style="float:left;">     <span class="avalue" id="a1value">         <label class="classoff" id="a1valuelabel">some value</label>         <span style="white-space: nowrap;">             <input id="a1catchvalue" maxlength="15" name="a1value" onblur="requiredfieldvalidation(&#34;a1postal&#34;)" size="15" tabindex="13" type="text"><img alt="required" height="9" id="a1valuereqdimg" src="/img/icn_dia.gif" width="11">         </span>     </span> </div> 

i need a1valuelabel , class classoff , turn classon

use this:

$("#a1valuelabel").removeclass("classoff").addclass("classon"); 

Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -