[jQuery] Is there an "append if" type function in jquery
I had a code that looks like this for now:
var rowObj = $.create('tr', {'id': "pod" + currPOCount, 'valign':
'top'})
.append($.create('td')
.append($.create('a', {'href': '#', 'onclick': 'delNonJobPOD
(\'pod' + currPOCount + '\');return false;'})
.text('delete')));
I was wondering if there was something like:
This is just a make belief function "appendif(check, action)" but just
to illustrate what I am getting at look at this code.
var rowObj = $.create('tr', {'id': "pod" + currPOCount, 'valign':
'top'})
.append($.create('td')
.appendif(function(){return (a==b);}, $.create('a', {'href':
'#', 'onclick': 'delNonJobPOD(\'pod' + currPOCount + '\');return
false;'})
.text('delete')));
That way if a==b is true the the append happens otherwise nothing
happens.
B.I.