html 的 `
在 Web 开发中,开发者常希望为非表单元素(如
✅ 正确做法如下:
HTML 中建议改用语义化 data 属性(更规范、可维护性更强):
点击获取信息
javaScript 中使用 .data() 或 .attr() 读取(注意区别):
推荐使用 .data(),代码更健壮:
function caller() { const classValue = $('#Class').data('classInfo'); // 返回数字 1 $.ajax({ url: 'test.php', type: 'GET', data: { Class_info: classValue }, success: function(data) { $('#Result').text(data); console.log('后端返回:', data); }, error: function(xhr) { console.error('AJAX 请求失败:', xhr.status, xhr.statusText); } }); }
⚠️ 注意事项:
总结:
pandas 如何在 merge 时只保留左表所有行但右表匹配列
css背景图片叠加颜色怎么做_结合linear gradient覆盖背景