Check First Char In String
I have input-box. I'm looking for a way to fire-up alert() if first character of given string is equal to '/'... var scream = $( '#screameria input' ).val(); if ( scream.charAt( 0
Solution 1:
Try this out:
$( '#screameria input' ).keyup(function(){ //when a user types in input boxvar scream = this.value;
if ( scream.charAt( 0 ) == '/' ) {
alert( 'Boom!' );
}
})
Post a Comment for "Check First Char In String"