จะทำยังไงให้ Tag a ตัวท้ายสุดมันหายไปด้วย jQuery ตอนกด button

พูดคุยแลกเปลี่ยน ปัญหา การเขียน JavaScript เครื่องมือ AJAX Web 2.0 AJAX Framework jQuery และ Node.JS รวมถึง Framework Express ของ Node.JS ทำงานฝั่ง Server

Moderator: mindphp

ภาพประจำตัวสมาชิก
thatsawan
PHP VIP Members
PHP VIP Members
โพสต์: 28508
ลงทะเบียนเมื่อ: 31/03/2014 10:02 am
ติดต่อ:

จะทำยังไงให้ Tag a ตัวท้ายสุดมันหายไปด้วย jQuery ตอนกด button

โพสต์ที่ยังไม่ได้อ่าน โดย thatsawan »

โค้ด: เลือกทั้งหมด

 <br><button style="width:36; height:17" class="mlike_disabled" type="button" value="" name="mlike" id="mlike_6" dd="" data-mpost="6" data-mcount="2" data-limit="1"></button>
<div class="tmb_like" id="mlike_user_6">

<a href="./../../../../memberlist.php?mode=viewprofile&u=48" class="username">thatsawan,+1</a> 

<a href="./memberlist.php?mode=viewprofile&u=2" style="color: #AA0000;" class="username-coloured">rongrong</a></div> 
                        

โค้ด: เลือกทั้งหมด

                     
                       if(mcount >  limit){ 
                              alert(a.length);
                                //      jQuery( ".tmb_like a:last-child" ).hide() ;
                                 //    jQuery( ".tmb_like a:last-child" ).addClass(".rong") ;
                                   // jQuery(".tmb_like").hide();
                                   jQuery(this).remove(".tmb_like a:last-child");                                   
                                 }

โค้ด: เลือกทั้งหมด

.rong {
    display: none !important;
}
หนูลอง

โค้ด: เลือกทั้งหมด

 jQuery(".tmb_like").hide();
มันหายไปหมดเลย
พอระบุ

โค้ด: เลือกทั้งหมด

  jQuery( ".tmb_like a:last-child" ).hide() ;
มันก้ไม่หาย
ภาพประจำตัวสมาชิก
thatsawan
PHP VIP Members
PHP VIP Members
โพสต์: 28508
ลงทะเบียนเมื่อ: 31/03/2014 10:02 am
ติดต่อ:

Re: จะทำยังไงให้ Tag a ตัวท้ายสุดมันหายไปด้วย jQuery ตอนกด button

โพสต์ที่ยังไม่ได้อ่าน โดย thatsawan »

โค้ด: เลือกทั้งหมด

jQuery.ajax({
	type: "POST",
                    url: 'ext/../m_button_like/event/tmb_ajax_like.php',
	data: {'post_id': mpost,count:mcount,'limit':limit}
                 
                        }).done(function(out) {
                                p = jQuery('#mlike_user_'+mpost).html();
                                if(!isNaN(out)){
                                    jQuery(obj).next().find('a[href$="u='+out+'"]').remove();
                                    jQuery('#mlike_'+mpost).prop('class','mlike') ;
                                    a  = jQuery('#mlike_user_'+mpost).find('a');
                                    if(a.length == 1) {
                                        s = jQuery('#mlike_user_'+mpost).find('a').html();
                                        jQuery('#mlike_user_'+mpost).find('a').html(s.replace(',',''));
                                    }
                                }  else {
                                    jQuery('#mlike_user_'+mpost).html(out+p);
                                    jQuery('#mlike_'+mpost).prop('class','mlike_disabled') ;
                                }

                          if(mcount >  limit){ 
                              alert(a.length);
                                //      jQuery( ".tmb_like a:last-child" ).hide() ;
                                 //    jQuery( ".tmb_like a:last-child" ).addClass(".rong") ;
                                   // jQuery(".tmb_like").hide();
                                   jQuery(this).remove(".tmb_like a:last-child");
                                 }
	});
});
ภาพประจำตัวสมาชิก
thatsawan
PHP VIP Members
PHP VIP Members
โพสต์: 28508
ลงทะเบียนเมื่อ: 31/03/2014 10:02 am
ติดต่อ:

Re: จะทำยังไงให้ Tag a ตัวท้ายสุดมันหายไปด้วย jQuery ตอนกด button

โพสต์ที่ยังไม่ได้อ่าน โดย thatsawan »

ได้ัเเย้ว เย้ๆ

โค้ด: เลือกทั้งหมด

      if(jQuery(".tmb_like a").length >  limit){ 
                                   jQuery(".tmb_like a:last-child").remove();
                                 }
เครดิต : tsukasaz
ตอบกลับโพส
  • Similar Topics
    ตอบกลับ
    แสดง
    โพสต์ล่าสุด

ผู้ใช้งานขณะนี้

สมาชิกกำลังดูบอร์ดนี้: ไม่มีสมาชิกใหม่ และบุคลทั่วไป 74