单选按钮选择索引更改,当添加icheck.js脚本引用时不触发
radio button selected index changed not firing when icheck.js script reference is added
aspx文件:
如果我们取消这个icheck.js引用的注释,那么事件正在触发。
<script src="../../UI/js/icheck.js"></script>
<asp:RadioButtonList
ID="RadioButtonList1"
runat="server"
AutoPostBack="true"
OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged"
BackColor="DarkCyan"
ForeColor="AliceBlue">
<asp:ListItem>HyperLink</asp:ListItem>
<asp:ListItem>LayoutEditorPart</asp:ListItem>
<asp:ListItem>BehaviorEditorPart</asp:ListItem>
<asp:ListItem>Localize</asp:ListItem>
<asp:ListItem>ImageMap</asp:ListItem>
</asp:RadioButtonList>
icheck.js在呈现为HTML单选元素时,正在给单选按钮列表应用样式。
icheck.js代码:
!function (a) {
function b(a, b, e) {
var f = a[0], g = /er/.test(e) ? q : /bl/.test(e) ? o : m, h = e == r ? {
checked: f[m],
disabled: f[o],
indeterminate: "true" == a.attr(q) || "false" == a.attr(p)
} : f[g];
if (/^(ch|di|in)/.test(e) && !h) c(a, g); else if (/^(un|en|de)/.test(e) && h) d(a, g); else if (e == r) for (var g in h) h[g] ? c(a, g, !0) : d(a, g, !0); else b && "toggle" != e || (b || a[x]("ifClicked"),
h ? f[s] !== l && d(a, g) : c(a, g));
}
function c(b, c, e) {
var k = b[0], r = b.parent(), t = c == m, u = c == q, x = c == o, y = u ? p : t ? n : "enabled", A = f(b, y + g(k[s])), B = f(b, c + g(k[s]));
if (k[c] !== !0) {
if (!e && c == m && k[s] == l && k.name) {
var C = b.closest("form"), D = 'input[name="' + k.name + '"]';
D = C.length ? C.find(D) : a(D), D.each(function () {
this !== k && a(this).data(i) && d(a(this), c);
});
}
u ? (k[c] = !0, k[m] && d(b, m, "force")) : (e || (k[c] = !0), t && k[q] && d(b, q, !1)),
h(b, t, c, e);
}
k[o] && f(b, z, !0) && r.find("." + j).css(z, "default"), r[v](B || f(b, c) || ""),
x ? r.attr("aria-disabled", "true") : r.attr("aria-checked", u ? "mixed" : "true"),
r[w](A || f(b, y) || "");
}
function d(a, b, c) {
var d = a[0], e = a.parent(), i = b == m, k = b == q, l = b == o, r = k ? p : i ? n : "enabled", t = f(a, r + g(d[s])), u = f(a, b + g(d[s]));
d[b] !== !1 && ((k || !c || "force" == c) && (d[b] = !1), h(a, i, r, c)), !d[o] && f(a, z, !0) && e.find("." + j).css(z, "pointer"),
e[w](u || f(a, b) || ""), l ? e.attr("aria-disabled", "false") : e.attr("aria-checked", "false"),
e[v](t || f(a, r) || "");
}
function e(b, c) {
b.data(i) && (b.parent().html(b.attr("style", b.data(i).s || "")), c && b[x](c),
b.off(".i").unwrap(), a(y + '[for="' + b[0].id + '"]').add(b.closest(y)).off(".i"));
}
function f(a, b, c) {
return a.data(i) ? a.data(i).o[b + (c ? "" : "Class")] : void 0;
}
function g(a) {
return a.charAt(0).toUpperCase() + a.slice(1);
}
function h(a, b, c, d) {
d || (b && a[x]("ifToggled"), a[x]("ifChanged")[x]("if" + g(c)));
}
var i = "iCheck", j = i + "-helper", k = "checkbox", l = "radio", m = "checked", n = "un" + m, o = "disabled", p = "determinate", q = "in" + p, r = "update", s = "type", t = "click", u = "touchbegin.i touchend.i", v = "addClass", w = "removeClass", x = "trigger", y = "label", z = "cursor", A = /ipad|iphone|ipod|android|blackberry|windows phone|opera mini|silk/i.test(navigator.userAgent);
a.fn[i] = function (f, g)
{
var h = 'input[type="' + k + '"], input[type="' + l + '"]', n = a(), p = function (b) {
b.each(function () {
var b = a(this);
n = n.add(b.is(h) ? b : b.find(h));
});
};
if (/^(check|uncheck|toggle|indeterminate|determinate|disable|enable|update|destroy)$/i.test(f)) return f = f.toLowerCase(),
p(this), n.each(function () {
var c = a(this);
"destroy" == f ? e(c, "ifDestroyed") : b(c, !0, f), a.isFunction(g) && g();
});
if ("object" != typeof f && f) return this;
var z = a.extend({
checkedClass: m,
disabledClass: o,
indeterminateClass: q,
labelHover: !0,
aria: !1
}, f), B = z.handle, C = z.hoverClass || "hover", D = z.focusClass || "focus", E = z.activeClass || "active", F = !!z.labelHover, G = z.labelHoverClass || "hover", H = 0 | ("" + z.increaseArea).replace("%", "");
return (B == k || B == l) && (h = 'input[type="' + B + '"]'), -50 > H && (H = -50),
p(this), n.each(function () {
var f = a(this);
e(f);
var g, h = this, n = h.id, p = -H + "%", q = 100 + 2 * H + "%", B = {
position: "absolute",
top: p,
left: p,
display: "block",
width: q,
height: q,
margin: 0,
padding: 0,
background: "#fff",
border: 0,
opacity: 0
}, I = A ? {
position: "absolute",
visibility: "hidden"
} : H ? B : {
position: "absolute",
opacity: 0
}, J = h[s] == k ? z.checkboxClass || "i" + k : z.radioClass || "i" + l, K = a(y + '[for="' + n + '"]').add(f.closest(y)), L = !!z.aria, M = i + "-" + Math.random().toString(36).substr(2, 6), N = '<div class="' + J + '" ' + (L ? 'role="' + h[s] + '" ' : "");
L && K.each(function () {
N += 'aria-labelledby="', this.id ? N += this.id : (this.id = M, N += M), N += '"';
}), N = f.wrap(N + "/>")[x]("ifCreated").parent().append(z.insert), g = a('<ins class="' + j + '"/>').css(B).appendTo(N),
f.data(i, {
o: z,
s: f.attr("style")
}).css(I), !!z.inheritClass && N[v](h.className || ""), !!z.inheritID && n && N.attr("id", i + "-" + n),
"static" == N.css("position") && N.css("position", "relative"), b(f, !0, r), K.length && K.on(t + ".i mouseover.i mouseout.i " + u, function (c) {
var d = c[s], e = a(this);
if (!h[o]) {
if (d == t) {
if (a(c.target).is("a")) return;
b(f, !1, !0);
} else F && (/ut|nd/.test(d) ? (N[w](C), e[w](G)) : (N[v](C), e[v](G)));
if (!A) return !1;
c.stopPropagation();
}
}), f.on(t + ".i focus.i blur.i keyup.i keydown.i keypress.i", function (a) {
var b = a[s], e = a.keyCode;
return b == t ? !1 : "keydown" == b && 32 == e ? (h[s] == l && h[m] || (h[m] ? d(f, m) : c(f, m)),
!1) : void ("keyup" == b && h[s] == l ? !h[m] && c(f, m) : /us|ur/.test(b) && N["blur" == b ? w : v](D));
}), g.on(t + " mousedown mouseup mouseover mouseout " + u, function (a) {
var c = a[s], d = /wn|up/.test(c) ? E : C;
if (!h[o]) {
if (c == t ? b(f, !1, !0) : (/wn|er|in/.test(c) ? N[v](d) : N[w](d + " " + E), K.length && F && d == C && K[/ut|nd/.test(c) ? w : v](G)),
!A) return !1;
a.stopPropagation();
}
});
});
};
}(窗口。jQuery || window.Zepto);
我面临的问题,我使用jquery修复它
$('.iCheck-helper').on('click', function (event) {
var mapper = $(this).siblings().find('input[type=radio]');
$('#' + $(mapper.prevObject).attr('id')).trigger("click");
});
。Icheck-helper是由插件自动生成的类
相关文章:
- 当包含另一个asp文件时,是否也包含所有引用的样式和脚本页面
- 什么's使用链接和脚本标记引用JavaScript源之间的区别
- 引用nodejs服务器中html中的java脚本文件
- 如果视图中没有Jquery脚本引用,Unobtrusive Javascript Validation是不起作用的
- 当我编写脚本时,它显示引用错误:未定义宽度
- ng-view 中的脚本在从文件引用时不起作用(JQuery 在角度之前加载)
- 如何在html中引用js脚本中的变量
- 使用require.js后,如何通过简单的脚本引用访问jquery全局命名空间
- 如何在加载表单时获得对Builder配置的Jenkins果冻脚本中表单元素的引用
- 如何从PHP文件输出javascript文件,该文件可以从脚本包含标记中引用
- 为什么谷歌应用程序脚本抛出'引用错误:“;粗体“;未定义'使用.setBold()时
- 使用script元素上的html data-*属性来配置引用的脚本文件
- 使用javascript"随机引用“;脚本,但跨越两个独立的元素
- HTML5 样板和循环渲染路径/引用脚本和样式
- HTML 页面不会加载引用脚本
- Angular和Asp.Net,可以't引用脚本目录中的angular js
- 如何从标记引用脚本文件中的函数
- MVC -引用脚本代码从视图内的js文件
- 如何引用脚本中引号内的图像
- 如何在url引用脚本中添加5秒等待