General Community > Scripting Help

jquery append issue

(1/1)

SA™:
so im working on addding  new minamise feature to my sa chat mod now i have it working but my problem is that it duplicates the entrys example i minamise a chat box it minamises but when i refresh the page it duplictaes the content so

instead of just showing

name it shows name name name is there a reson for this?

im using this


--- Code: ---function doCookies() {
jQuery.noConflict()(function($){
$.each(document.cookie.split(\';\'), function(i, cookie) {
var c = $.trim(cookie), name = c.split(\'=\')[0], value = c.split(\'=\')[1];
var cname = name.substring(0, name.length - 1);
    var cSession = new getCookieArray(cname);
    if (cSession[1] == \'2sichat\') {
chatTo(cSession[2]);
document.getElementById(cSession[2]).style.left = cSession[3]+\'px\';
document.getElementById(cSession[2]).style.top = cSession[4]+\'px\';
}
if (cSession[1] == \'2sichat_gadget\') {
openGadget(cSession[2].substr(6));
document.getElementById(cSession[2]).style.left = cSession[3]+\'px\';
document.getElementById(cSession[2]).style.top = cSession[4]+\'px\';
}

if (cSession[1] == \'2sichat_min\') {
   var tsting = \'minchats\'+cSession[2];
   
   //document.getElementById(\'minchats\').innerHTML += \'&nbsp;&nbsp;<span id="\'+tsting+\'"><a class="white" href="javascript:void(0)" onclick="javascript:chatTo(\'+cSession[2]+\');return false;"><strong>\'+cSession[3]+\'</strong></a>&nbsp;&nbsp;</span>\';

   $(\'#minchats\').append(\'&nbsp;&nbsp;<span id="\'+tsting+\'"><a class="white" href="javascript:void(0)" onclick="javascript:chatTo(\'+cSession[2]+\');return false;"><strong>\'+cSession[3]+\'</strong></a>&nbsp;&nbsp;</span>\');
}

});
});
}
--- End code ---

and this


--- Code: ---function minchat(budid, budname) {

var div = document.getElementById(arguments[0]);
div.parentNode.removeChild(div);

if (window["re" + budid]) {
clearInterval(window["re" + budid]);
}
delCookieArray(\'msg_win\' + arguments[0]);

var tsting = \'minchats\'+ budid;

var session = new setCookieArray(\'min\'+budid, \'2sichat_min\',+budid, budname);

jQuery.noConflict()(function($){

                $(\'#minchats\').append(\'&nbsp;&nbsp;<span id="\'+tsting+\'"><a class="white" href="javascript:void(0)" onclick="javascript:chatTo(\'+budid+\');return false;"><strong>\' + budname + \'</strong></a>&nbsp;&nbsp;</span>\');
});
}
--- End code ---

SA™:
sry i cant realy explain this any better :(

SA™:
i think i got it with

if (document.getElementById(\'minchats\'+cSession[2]) == undefined){code}

Navigation

[0] Message Index

Go to full version