At midnight, @Joseinnewworld quietly added 8 more #NFTs to his collection 🌙🔥 Truly grateful for the unwavering support — especially in times like these, when #eCash $XEC hasn’t yet moved upward. Your patience and consistency mean a lot 🙏#NFTcollectors #NFTCommunity #NFTdrops pic.twitter.com/UryHUacpsW
— NFToa (@nftoa_) August 25, 2025
Is this a good way to check if a field value is null? is it like this?
if($('#person_data[document_type]').value() != 'NULL'){}Or is there a better way?
Solutip
The field value cannot be null, it is always a string value.
The code will check if the string value is the string "NULL". You want to check if it is an empty string:
if ($('#person_data[document_type]').val() != ''){}or:
if ($('#person_data[document_type]').val().length != 0){}If you want to check whether the element exists, you must do so before calling val:
var $d = $('#person_data[document_type]');
if ($d.length != 0) {
if ($d.val().length != 0 ) {...}
}
