$('.emailSuffix').click(function(){ var field = $('#element'); if (field.val() == 'something'){ //ok } else { //not ok } });
On Jan 13, 7: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 a particular textbox element so that it accepts values for that > particular class. Whenever there is a different value inserted, it > displays a jquery error. Now, there also is an Add button which should > add the value and display it in a widget list if it is a "valid > value". > > So, I need to check and insert an if else block on the click event of > the add button to check if the value inserted in the textbox is a > valid email suffix type. How do I check that > > something like > if ($(#element_id).val.className == emailSuffix) > { > ... > } > else > { > ... > }