{ //alert(src.id); //alert($(this).attr('class')); $(this).remove(); } <?php if ($getId != "") { ?> $('.contentclick').on('click','.off',deletex); var availableTags = <?php include 'getfile.php'; ?> ; $("<?php echo $dataprocess->RemoveLastComma($getId); ?> ").autocomplete({ source: availableTags, autoFocus:true, minLength: 2, select: function( event , ui ) { //alert( "You selected: " + ); //alert($(this).attr('id').substr(1,5)); $thisId = ".content"+$(this).attr('id').substr(1,5); //alert($thisId); $(this).val(""); $($thisId).append("<div class='off'>"+ui.item.label+"</div>"); event.preventDefault(); } });