First of all, I apologize for my poor English.
I’m using jquery plugin jParse which parse xml easily. here is the demo page(http://jparse.kylerush.net/demo)
I’ve tried a couple times but can’t seem to figure out how to remove <a> tag if the href is empty.
Here is my code:
elementTag: ['category', 'pubDate', 'title', 'link', 'description'];
output: '<dl><dt class="jpet00">jpet01</dt><dd><strong><a href="jpet03">jpet02</a></strong><br />jpet04</dd></dl>';
if the xml ‘link’ node is empty, i want to output like this
output: '<dl><dt class="jpet00">jpet01</dt><dd><strong>jpet03jpet02</strong><br />jpet04</dd></dl>';
I tried $(“a[href=”]”).remove() but it didn’t work.
Are there any suggestions? Thanks in advance!
Where are you calling
$("a[href='']").remove()– it should be in yourfinish()function shown in the demo. If this is where you are using it it may be that the href is not entirely empty. Try:EDIT 1 as requested in comments