bootstrap参数传递可以用 data-参数名
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title></title> <link href="css/bootstrap-3.3.4-dist/css/bootstrap.min.css" rel="stylesheet" /> <script src="js/jquery-2.1.3.min.js"></script> <script src="css/bootstrap-3.3.4-dist/js/bootstrap.min.js"></script> <script type="text/javascript"> $(function () { console.log($(‘#test‘).data(‘user‘)); console.log($(‘#test‘).data(‘names‘)); }) </script> </head> <body> <div id="test" data-user="张三" data-names="小李4啊"></div> </body> </html>
时间: 2024-10-21 23:42:13