Bind function to class?

Bind function to class?

Stuck to a hopefully simple problem. When the window loads, I want a function to check all text fields with a certain class if there is a value. If there is no value in the text field the value 0 will be set to the field. So far this is my code, but it does not work:

$(window).load(function() {
       $(".classx,.classy").(function() {if ($(this).val() == "") {(this).val("0")}});


});