隐藏变量


Hiding a variable

我有一个JavaScript待办事项列表,其中有3个变量,即从e数据库中提取信息的表中的3列。3是id、内容和状态,当在列表中显示数据时,它会显示内容和状态(这只是一个数字),数字决定了内容的颜色,我使用CSS完成了这一操作,但我不希望数字显示在内容后面,有什么方法可以隐藏这一点吗?

以下是一些引入它的php代码:

public function getList()
    {   
        $link = $this->connect();
        // Query for all the entries from the table and order them based on the id descendingly
        $query = "SELECT * FROM tbToDoList ORDER BY STATUS";
        $res = mysql_query($query);
        $res_array = array();
        // fetch all the entires one by one
        while($row=mysql_fetch_array($res)){
            // put query result in php array
            $array = array('id' => $row['id'],
                           'content' => $row['content'],
                           'status'=> $row['status']); 

下面是一些JS//呈现待办事项列表视图

todo.getView = function (res){
    // if the list has more than two entries, grants the permission to use massive weapon/delete all
    if(res.length >= 2){
        $('#massiveWeapon').css('display', 'block');
    }
    // update the list view
    for (var i=0; i< res.length; i++){
$("<li/>", {"id": res[i].id, "text": res[i].content + res[i].status, "class": 'status-' + res[i].status}).appendTo(todo.list);      if(res[i].content.length >= 35){
            $('#'+res[i].id).css("height","50px");
        }
    }
}       

谢谢你的帮助。

在项目的javascript定义中,您将文本设置为res[i].content + res[i].status。如果不希望在文本中显示状态,请从文本中删除+ res[i].status