开发者

Why do I get a syntax error on the semicolon?

开发者 https://www.devze.com 2023-02-12 18:48 出处:网络
This bit of code does not produce any errors: //if the image has tags if(data.photo.tags.tag != \'\') {

This bit of code does not produce any errors:

//if the image has tags
if(data.photo.tags.tag != '') {

    //create an empty array to contain all the tags
    var tagsArr = new Array();

    //for each tag, run this function
    $.each(data.photo.tags.tag, function(j, item){

        //push each tag into the empty 'tagsArr' created above
        tagsArr.push('<a href="http://www.flickr.com/photos/tags/' + item._content + '">' + item.raw + '</a>'开发者_开发百科);

    });

    //turn the tags array into a string variable
    //var tags = tagsArr.join(' ');
}

But If I change the tags array push line to:

//push each tag into the empty 'tagsArr' created above
    tagsArr.push( + item.raw + );                                    
});

Then I get a syntax error on the semicolon. What I'm trying to do is to remove the tagged links and just return raw links.

Thoughts & Thanks!


if you just want the output the item.raw value do:

tagsArr.push(item.raw);
0

精彩评论

暂无评论...
验证码 换一张
取 消