\t\t} \t); \t\$('[id^="id-"]').click(function(){ \t\tvar item = \$(this).attr('id'); // id of the item to change \t\tvar parent = \$('#'+item).parent().parent().parent().attr('class'); // the class contains current visibility of item \t\t\$.ajax({ \t\t\turl: "ajax.visibility-toggle.php", \t\t\tdata: "social=" + item + "&class=" + parent, \t\t\tdataType: "html", \t\t\tsuccess: function(data){ \t\t\t\ttoggleVisStyle(item); \t\t\t} \t\t}); \t}); \t\$('[id^="widget-"]').click(function(){ \t\tvar item = \$(this).attr('id'); // id of the item to change \t\tvar parent = \$('#'+item).parent().parent().parent().attr('class'); // the class contains current visibility of item \t\t\$.ajax({ \t\t\turl: "ajax.visibility-toggle.php", \t\t\tdata: "widget=" + item + "&class=" + parent, \t\t\tdataType: "html", \t\t\tsuccess: function(data){ \t\t\t\ttoggleVisStyle(item); \t\t\t} \t\t}); \t}); EOL; $view->add_jquery_ui(); $view->add_inline_script($js_call); $output = $view->close_view(); print $output;