js注意事项

 

在数组顶部插入一条数据
data.result.unshift({ Value: 'all', Text: '请选择分类' });
执行iframe中的javascript方法

window.frames['framename'].functionName(); 

document.getElementById("iframeId").contentWindow.functionName();

目前最有效的检查checkbox是否被选中的方法

var check = $('#checkpwd').is(":checked");

function checkThis(el) {
            var checkRoom = $(el).children().eq(0);
            var check = checkRoom.is(":checked");
            if (check) {
            userCount--;
                checkRoom.prop('checked', false);
                checkRoom.next().attr('src', 'image/fangkuaicancel.png');
                
            } else {
                checkRoom.prop('checked', true);
                checkRoom.next().attr('src', 'image/fangkuaiyes.png');
                userCount++;
            }
            $("#num").text(userCount);
        }

转换为int

$('#clickSupport' + i).text(parseInt($('#clickSupport' + i).text()) + 1);

select选择事件

$('#selectEvent').change(function () {
LoadEventParticipantsWorks($(this).children('option:selected').val());
});

序列化form

var serverData = $("#editForm").serializeArray();//必须加name属性。

 空格:&nbsp

原文地址:https://www.cnblogs.com/Celebrator/p/4455840.html