Jump to content
php.lv forumi

var + attr + parent


anonīms

Recommended Posts

Tēma saistīta ar jau vienu tematu no šīs sadaļas, bet tur nez kapēc neviens neatbild.

Tātad nepieciešams izveidot ejošu var, kuru tālāk pievienotu linkam

  //izveidojam msgboxiem ieksejo strukturu
$(".msgbox").each(function(){
var o = $(this).parent();  

var vestules_id= $("div").attr("id");

 $(this).append('<div>'+
'<div class="msgcontent">'+
'<div class="msgtext"></div>'+
'<div class="msgtoolbar">'+
  '<a href="?a=vestules&darbiba=atbildet&v_id='+vestules_id+'">Atbildēt</a>'+
  '<a href="#" class="msgsend">Sūtīt</a>'+
'</div>'+  
 '</div></div>');
});

Pašlaik kā vestules_id tiek ņemts 1 div id vārds, kas tiek atrast, bet nepieciešams iegūt īsto vēstules id

 

 

posto lūk šadi

//pievienojam clikc eventu visiem .msgbox-iem
$(".msgtitle").bind("click",function(){
 var o = $(this).parent();  
 //parbaudam vai teksts zina ir redzama
 if (o.data('ismsg')==1){
o.data('ismsg',0).find('.msgcontent').hide();
 } else {
//ja nav redzama, tad parbaudam vai vina ir ieladeta un vienkarsi jaatelo, vai ari jaielade
if(o.data('ismsg')==0){
  o.data('ismsg',1).find('.msgcontent').show();
} else {
  $.post('/include/vestules_skatit.php',{id:o.attr('id')},function(d){o.data('ismsg',1).find('.msgcontent').show().find('.msgtext').html(d);},'html');


}
 }
 return false;
});

 

Nesanāk man pievienot šo o parentu.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...