hiding a div in response to data within XML node
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
It is not the job you get handed, but what you have done with it in the end that matters.
Bookmarks