css - 交替行颜色未正确应用

标签 css jquery-ui uitableview jquery

以下是我正在使用的 jQuery 搜索功能,

$("#btnSearch").click(function () {
    debugger
    var assoid = $('#txtAssoID').val();
    var tassoid = $.trim(assoid);
    if ((tassoid == "") || (tassoid == "Ex: Associate Id1; Associate Id2; Associate Id3")) {
        alert("Please enter Associate ID");
        return false;
    } else if (tassoid != "") {

        for (var i = 0; i < tassoid.length; i++) {
            if (tassoid.charAt(i) == ':') {
                alert("colon should not be used");
                return false;
            }
        }
        var associateIDs = new Array();
        var array = tassoid.split(";");
        var array1 = tassoid.split(";").length;
        for (var k = 0; k < array1; k++) {
            var id = array[k];
            associateIDs[k] = id;
            if (k == 0) var associate = id;
            else var associate = associate + ',' + id;

            if (id.length != 6) {
                alert("Please enter 6 digit valid Associate ID");
                return false;
            }
        }
    }
    $.get("Search", {
        'AssoIdsForAccess': associate
    }, function (data) {
        $("#Search").html(data);
        $("#btnUpdate").removeAttr("disabled");
    })
});

第一次加载网页时(html 数据显示为表格)表格行显示背景颜色,但当我第二次搜索 id 时,背景颜色未应用,这将是问题的位置?

最佳答案

试试这个:live('click', function(){}) 如果你可以使用 jQuery 2.0 你必须使用 on('click', function(){})

关于css - 交替行颜色未正确应用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19853271/

相关文章:

html - 是否允许 ul 在 html 或 xhtml 中插入内联 li?

jquery - 拖放问题

jquery - 函数仅在将alert()放入内部时运行

ios - UITableView header 隐藏在 Swift 中的 beginUpdates() 上

html - 响应式 Canvas 超越了 div

html - 在 Django 中操作 oembed

css - 为什么在 Firefox 中 location.hash 之后样式效果仍然存在?

jquery - 将 Enter 键绑定(bind)到 jquery ui 对话框按钮

ios - TableView 不显示数据,为什么? ( swift 3)

ios - 调整文本大小以适合宽度(1 行标签)后,如何在 UILabel 中垂直和水平居中?