0
我需要在页面加载时检查特定引导程序开关元素的当前状态,并且想用onInit回调来解决这个问题。不幸的是,当我询问当前状态时,它给出了“未定义”。这是到目前为止我的代码...onInit回调自举开关检查元素的初始状态
$(".make-switch").bootstrapSwitch({
onText:'ja',
offText:'nein',
onColor:"success",
offColor:"warning",
indeterminate: true,
size:"big",
onInit:function(event,state)
{
var current_element=$(this).attr("id");
if(current_element=="has-emotion")
{
alert(state); //gives me "undefined" for this and every other element
}});
我的引导交换机版本是V3.3.2和jQuery 2.1.4版
我在做什么错在这里?还是有其他的方式来检查加载页面时给定元素的状态?
非常感谢! 问候来自奥地利
顺便说一句:非常感谢你,就解决了! – uemit
欢迎您。请接受这个答案。 –