I have the following jquery and you want to check if the text field is empty before the code runs:
<script type="text/javascript"> $(document).ready(function () { if ($("#FNameTB").val().length < 0) { $("input#FNameTB").labelify({ labelledClass: "greylabel" }); } </script>
but does not work.
The length will never be less than 0.
if ( $("#FNameTB").val().length === 0 )
You can even add to trim () to be thorough
if ( $("#FNameTB").val().trim().length === 0 )
Try
if ($("#FNameTB").val() == '')
Try to execute
if ($('#FNameTB').val() === '') { // It empty }
Source: https://habr.com/ru/post/896895/More articles:https://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/896890/sending-parameters-to-the-soap-asmx-service-from-ios-application&usg=ALkJrhgxtJDIsmMuMf2zGK4P-i8n3pd3twHold showing MaxInt - iosNginx / fastcgi 504 error, increasing fastcgi_read_timeout doesn't help - phpHow to calculate slope in numpy - pythonA circular dependency in a pick pattern using C # - c #Long-Term PL / SQL Block Monitoring - sqlMagento payment methods: how to get the data that was set via Mage_Payment_Model_Method_Abstract :: assignData ()? - phpwhich is faster: recreate or clean ()? - c ++overload loadView in subclass of UITableViewController - iphonereordering a list using lambda - listAll Articles