传入class、id name 的函数封装

 1 function chooseDate(idName){ 
2
$('#' + idName).click(function(){ 3 //执行函数
4 });
5 };
6 //传入的 dataOne 就是 class 或者 id 的名称 这里传的是 字符串类型
7 chooseDate("dataOne");
//这里调用的时候记得要有双引号
浩楠哥
原文地址:https://www.cnblogs.com/haonanZhang/p/6262256.html