Skip to main content

 

Check if inputs are empty using jQuery


Option 1

$('input').blur(function()
{
    if( !$(this).val() ) {
          $(this).parents('p').addClass('warning');
    }
});

Option 2

$(input').blur(function()
{
    if( $(this).val().length === 0 ) {
        $(this).parents('p').addClass('warning');
    }
});

Option 3

$(input').blur(function()
{
      if( !this.value ) {
            $(this).parents('p').addClass('warning');
      }
});

Comments

Popular posts from this blog

Error: [Reanimated] valueUnpacker is not a worklet, js engine: hermes Fixed it with a version downgrade: npm install react-native-reanimated@3.4.2 And editing the babel.config.js file: module.exports = {   presets: ['module:metro-react-native-babel-preset'],   plugins: ['react-native-reanimated/plugin'], }; 
 jQuery select change show/hide div event <script>   $(document).ready(function(){     $('#selectID').on('change', function() {       if ( this.value == 'red')       {         $("#divid").show();       }       else       {         $("#divid").hide();       }     }); }); </script>
Fetch not working in release APK - React Native Make sure your config.urlServer is not an HTTP endpoint but should be HTTPS. Latest RN versions target recent Android SDK that blocks insecure HTTP connections automatically. Quick Fix: Adding android:usesCleartextTraffic="true" in <application> tag in android\app\src\main\AndroidManifest.xml will work.