Hi MorningZ I tried the solution suggested by you, but as I had expected it didn't work. What I want is to check if the value in the textbox element is of the emailSuffix class type or not And NOT the textbox itself. So, $("#element_id").hasClass(emailSuffix) will always give me true because the element is of the emailSuffix classtype. However, the value in the textbox which may be anything entered by the user has to be validated for the particular class type. Hence I needed a code similar to if($(#element_id).val.className == emailSuffix)......
Please help if you can. Thanks in advance On Jan 15, 5:21 pm, Santo <pujari.sant...@gmail.com> wrote: > thanks a lot MorningZ... willcheckand get back to you... > > On Jan 13, 9:05 pm, MorningZ <morni...@gmail.com> wrote: > > > Your problem isn't very clear.... but regardless, there is a > > ".hasClass" function > > >http://docs.jquery.com/Attributes/hasClass#class > > > so > > > $("#element_id").hasClass(emailSuffix) > > > would give you true/false > > > . > > . > > . > > > On Jan 13, 4:39 am, Santo <pujari.sant...@gmail.com> wrote: > > > > Hello All > > > > This is what I am trying to do. I have defined an "email suffix"class > > > for aparticulartextboxelementso that it accepts values for that > > >particularclass. Whenever there is a differentvalueinserted, it > > > displays a jquery error. Now, there also is an Add button which should > > > add thevalueand display it in a widget listifit is a "valid > > >value". > > > > So, I need tocheckand insert anifelse block on the click event of > > > the add button tocheckifthevalueinserted in the textbox is a > > > valid email suffixtype. How do Icheckthat > > > > something like > > > if($(#element_id).val.className == emailSuffix) > > > { > > > ... > > > } > > > else > > > { > > > ... > > > }