If my understanding is correct, the request is to change the font every time the value of the input field contains the number 1.
This solution will apply for both "1" and "abc de 1 fg"
JavaScript
$('input[value*="1"]').css({'font-family':'Helvetica','color':'#990000'});
Check out the working example:
http://jsfiddle.net/U3weP/1/
To target only the exact value 1, just remove the * in the selector.
JavaScript
$('input[value="1"]').css({'font-family':'Helvetica','color':'#990000'});
To enable real-time font change as you type, use the following function which reverts back to normal state when necessary.
HTML
<input type="text" name="test1" value="1" />
<input type="text" name="test2" value="2" />
<input type="text" name="test3" value="3" />
<input type="text" name="test4" value="abc 1 def" />
CSS
.different {
font-family:'Helvetica';
color:#990000;
}
JavaScript
$('input').on('keyup',function() {
if($(this).val().indexOf('1') != -1) {
if(!$(this).hasClass('different')) {
$(this).addClass('different');
}
} else {
$(this).removeClass('different');
}
}).trigger('keyup');
See it in action on fiddle http://jsfiddle.net/U3weP/4/