My way: code
<form>
<input type="text" value="">
<input type="submit" value="submit"> type a space and press Submit
</form>
$('form').submit(function(){
if($('input').val() == ' ') {
alert($('input').val().length);
}
return false;
});
But I’d like to solve this problem using CSS3 selectors like $('input[value*=" "]')
If you are asking to use CSS3 selector through jquery then
$(':input[value*=" "]')should do it.example: http://www.jsfiddle.net/gaby/cruRd/
If you want to create an actual CSS3 rule in your stylesheet then
input[value*=' ']{..}will work, but only for values in the actual attribute (in the source code) and not the value as modified inside the browser..example: http://www.jsfiddle.net/gaby/VzE9T/