Forum Discussion
ApostolosGiatsi
2 years agoQuickbase Staff
Hello Charlene,
It's a bit tricky to provide a solid answer here without seeing the general structure and logic of your code.
In general, to check for empty tags with jQuery, you first need to parse the XML. Then you can iterate through each tag and check if it's empty (self-closing) like "<detail_note/>.
Here's a simple script to help you get started:
var xmlDoc = $.parseXML(XMLresponse);
$(xmlDoc).find('*').each(function() {
if ($(this).is(':empty')) {
console.log("Empty field found: " + this.nodeName);
}
}
The above script does the following:
- Creates a variable that stores the API Response using the parseXML() function.
- Finds all the tags using find() function and then iterates through them.
- Checks each node if is empty (no child nodes or text).
- Prints on the console the tag name. You can perform any action here with the returned information
Hope that helps!
------------------------------
Apostolos Giatsidis
------------------------------