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
歡迎您。請接受這個答案。 –