How to remove javascript or css from input tag
===

i hava a comment panel,When user enter the comment i make a ajax request and send the data to database and than return the data with `mysql_insert_id()` and append to division

my ajax code is 

 

 

    if(commentlength(typ)){
                              var data=$(typ).serialize();
                         $.ajax({data:{"data":data,"forwhat":"commentpost"},datatype:"json",success:(function(arrdata){
                        var aaa=$.parseJSON(arrdata);
                         $(typ).effect("fold");
                        $(typ).parent().prev().css("display","block");
                        $(typ).parent().css("display","none");
                       if(typeof aaa["error"] == 'undefined'){
                              $(newdiv).append("<div class=\"comments float_left width_100 padding_tb_5\">"+    
                                                     "<div class=\"comment-action\">"+
                                                     "<div class=\"comment-content float_left\">"+
                                                      "<input type=\"hidden\" class=\"commentid\" value="+aaa["id"]+" />"+aaa["comment"]+" "+"<a href=\"javascript:void(0)\">"+aaa["name"]+"</a>"+ 
                                                           "<span title=\"delete this comment\" class=\"ui-state-default ui-corner-all ui-icon ui-icon-close\" style='float:right; margin-left: 7px;'></span><br /><span class='commenttime'>JUST NOW</span>"+
                                                     "</div></div>");
                            
                       }else{
                            showerror(aaa["error"]);
                       }
        })})                      
           }})

and my php code for fetching is 

  

      <?php while($questioncomment=mysql_fetch_array($result)){ ?>   
                                                <div class="comments float_left width_100 padding_tb_5">    
                                                         <div class="comment-action float_left"> 
                                                           <?php if(login() && ($_SESSION["id"]!=$questioncomment["user_id"])){
                                                                 echo " <a href=\"javascript:void(0)\" class=\"comment-flag\" title=\"flag this comment\"><span class=\"ui-icon ui-icon-flag\"></span>";
                                                           }  ?>
                                                         </div>
                                                         <div class="comment-content">
                                                               <input type="hidden" class="commentid" value="<?php echo $questioncomment["id"];?>" />
                                                           <?php echo htmlspecialchars($questioncomment["content"])." <a href=\"javascript:void(0)\">".$questioncomment["realname"]."</a>";?>
                                                            
                                                               <?php if(login() && ($_SESSION["id"]==$questioncomment["user_id"])){
                                                                 echo "<span title=\"delete this comment\" class=\"ui-state-default ui-corner-all ui-icon ui-icon-close float_left\" style='float:right; margin-left: 7px;'></span>"."<br/><span class='commenttime'>".timegenerator($questioncomment["time"])."...</span>";
                                                          }  ?> 
                                                         </div>
                                                     </div>
                                                     <?php }?>

the question is that when i write some java script code like (script type="txt/javacript")alert("hello")(/script)  than it shows me alert and when i reload the page than it also shows me alert()...but adding comment to database is working fine...
i am using (script) instead of orignal tag <> tag because wmd editor donot allow me to write...can anyone help me?