Change css class if input has a value
How can I change the CSS class of an input field, if that input field has
a value
Example:
<input name='referrer' type='text' class='input-xlarge placeholder'
placeholder='Referrer' value='{$ref}' style='width:346px;'>
Currently, I am doing like this:
if ($('#reffield').val() != ''){ $('#reffield').addClass('classname'); }
But that doesn't have any effect, nor does it generate any error.
No comments:
Post a Comment