jQuery检查rel将无法正常工作

I have one question about rel attribute.

The problem is if else statement from the following line:

if(REL == 'Like') {
    // Do something

   if($("#love" + New_ID).attr('rel','UnLove').attr('title', 'UnLove')){
      // Do Something
   }

}

When i click .yes_button then it is checking REL == 'Yes' and also i want to check $("#love" + New_ID).attr('rel','UnLove').attr('title', 'UnLove') but it is not working.

Anyone can tell me what i need to do here for it ?

This is full code:

var count= 0;
  $('body').on("click",'.like_button', function() {
    //$(this).closest('.new_like_items').children().hide();  
    var dataid = $(this).attr('data-id');
    var id = $(this).closest('.new_like').attr('id');

    var class_name = $(this).find(".icon-newL").attr("class");
    class_name = class_name.replace(/icon\-newL\s+/gi, "");
    $(this).closest(".new_like").find(".icon-lpn").removeClass().addClass("icon-lpn " + class_name);
    var count = 0;
    var KEY = parseInt($(this).attr("data"));
    var ID = $(this).attr("id");
    if (KEY == '1') {
      var sid = ID.split(/likes|loves/);
    } else {
      var sid = ID.split(/like|love/);
    }
    var New_ID = sid[1];
    var REL = $(this).attr("rel");

    var URL = $.base_url + 'like_post.php';
    var dataString = 'msg_id=' + New_ID + '&rel=' + REL;
    $.ajax({
      type: "POST",
      url: URL,
      data: dataString,
      cache: false,
      success: function(html) {
        if (html) {
            // Like Started
          if (REL == 'Like') {
            //count++;
            //$("#likess" + New_ID).show('slow');
            if($('#likess' + New_ID).css('display') == 'none'){  $("#likess" + New_ID).show('slow'); }
               $("#elikes" + New_ID).show('slow').prepend("<span id='you" + New_ID + "' class='numcount bbc'><div class='icon-newL icon-like-new lpos' id='clk" + New_ID + "'></div><div class='lcl' id='lcl" + New_ID + "'>"+ count +"</div></span>");
               $('#lcl'+ New_ID).html(function(i, val) { return val*1+1 });
               $('#' + ID).html('<div class="icon-newL icon-like-new"></div>').attr('rel', 'UnLike').attr('title', 'UnLike');
            if($("#love" + New_ID).attr('rel','UnLove').attr('title', 'UnLove')) {
               //count--;
               $('#love' + New_ID).html('<div class="icon-newL icon-love-new"></div>').attr('rel', 'Love').attr('title', 'Love');   
               $('#lco'+ New_ID).text(function(i, val) { return val*1-1 });
               //$("#love_count" + New_ID).hide('slow').prepend("<span id='love_count" + New_ID + "' class='numcount bbc'><div class='icon-newL icon-love-new lpos'></div><div class='lco' id='lco" + New_ID + "'>"+ count +"</div></span>");   

             }
              $('#like_count' + New_ID).show('slow');
          } else if(REL == 'UnLike'){
                // Do Something
            }
          // Like Finished
        }

      }
    });

    return false;
  });

HTML

<div class="op-lw like_button" data-id="0" id='like<?php echo $post_id;?>' rel='<?php echo $postL_status;?>' title='<?php echo $postL_status;?>'><div class="icon-newL icon-like-new"></div></div>
<div class="op-lw like_button" data-id="1" id='love<?php echo $post_id;?>' rel='<?php echo $Lpost_status;?>' title='<?php echo $Lpost_status;?>'><div class="icon-newL icon-love-new"></div></div>

Are you sure you don't mean something like:

if($("#love" + New_ID).attr('rel') == 'UnLove' && $("#love" + New_ID).attr('title') == 'UnLove'){
   //....
}