how to us blur() function with input mask
I am using this input mask plugin,
http://digitalbush.com/wp-content/uploads/2013/01/jquery.maskedinput-1.3.1.min_.js. What I am trying to do is to use the blur(). Currently right now, I have blur working, but only to a certain extent. What I mean is that if the text field is empty, the blur() works. But if the text field contains data, the blur() is still kicking in and displaying the value that I have set for blur into the textfield rather than keeping what is inputting in the field. I am unsure of why this is happening. This is the coding that I am working with right now.
- jQuery(function ($) {
- $.mask.definitions['~']='[+-]';
- $('.run').mask('99:99');
- $('.run').val('TBD');
- $('.penalty').mask('99:99');
- $('.penalty').val('TBD');
- //$('.com').val('TBD');
-
- })
- $(document).ready(function()
- {
- if ($(this).val() == "")
- {
- $('input[type="text"]').blur(function()
- {
- //$(this).unmask();
- $(this).val("TBD");
- });
- }
- });
I have it set up to only blur on text fields. With my mask, the input would be inputted like: 01:00. Thank you in advance for your help. I feel like this is a simple fix, but I can not seem to see where it is that i am not looking.