I am trying to hide a div or id if the returned xml file has no data within a specific node. I am working with jQuery 1.4.2 and a jq plug-in jqGrid. The grid goes out and gets a static xml file. Then upon the user selecting a row, it appends data within that master node to specific divs and/or id(s). I am having issues with a if/else statement (pure JS) that is supposed to evaluate a targeted xml node and respond accordingly. If there is data within a specific node, the html div or id is "show" (default setting). If there is NO data within that xml node, I need to "hide" that html div/id. In my code below, firefox says I have a syntax error. I just don’t see it. Also, I can not get it to act accordingly. Any help would be greatly appreciated.
Code:
onSelectRow: function() {
var gsr = $('#searchResults').jqGrid('getGridParam', 'selrow');
if (gsr) {
var data = $('#searchResults').jqGrid('getRowData', gsr);
$('#dodic').append('DODIC: ' + data.dodic);
$('#title').append('Nomenclature: ' + data.nomenclature);
$('#purpose').append('Use: ' + data.purpose);
$('#description').append('Description: ' + data.description);
function() {if (data.olValue.length >= 1) {$('#objLength').append('Length: ' + data.olValue + ' ' + data.olUnit);} else {$('#objLength').hide();}};
$('#basicMun #objWidth').append('Width: ' + data.owValue + ' ' + data.owUnit);
It is that function call that is the problem.
Tony:confused:
Similar:
- Pull specific XML node(s) into HTML document Hi all, first time poster. Please be gentle. This topic may be similar to several other questions out there, but as far as I can...
- node.js data into JQuery AJAX on different port Hey everyone, I’ve been investigating node.js recently but I can’t seem to figure it out. I have this as a server: var sys = require('sys'),...
- How do I get the reference to the dom node I just appeneded in JQuery? I just appended some html to another JQuery object. I want to get a reference to the newly created dom node so that I can...
- Hiding buttons when not needed. Hello there I use Jquery in my page to hide buttons which i dont want to show unless needed. In this case its a table...
- Drupal 6: listing in custom-node.tpl.php what fields are available to use for the current node? Hi friends, I’m a drupal newbie… Is there any way to list in my custom-node.tpl.php what fields are available to use for my current node?...
[...] hiding a div in response to data within XML node | The Largest … [...]
[...] hiding a div in response to data within XML node | The Largest … [...]