【发布时间】:2011-09-23 06:56:20
【问题描述】:
是否可以使用 jQuery 禁用/注释掉一个头文件,然后再重新启用它,打开/关闭禁用/启用它?
【问题讨论】:
标签: jquery header comments out
是否可以使用 jQuery 禁用/注释掉一个头文件,然后再重新启用它,打开/关闭禁用/启用它?
【问题讨论】:
标签: jquery header comments out
试试这个(对于 css 文件):
$('link[type="text/css"]').each(function(){
var $ele = $(this);
//check if atribute data is set and has info
if ($ele.attr('data') !== undefined && $ele.attr('data') !== ''){ //set, so adding that info to href attribute and emptying data attribute
$ele.attr('href', $ele.attr('data'));
$ele.attr('data', '');
} else{ //not set/empty, so setting/filling it and emptying href attribute
$ele.attr('data', $ele.attr('href'));
$ele.attr('href', '');
}
});
【讨论】: