node.js - 节点js按钮点击
问题描述
我有这个使用 node.js 运行的翡翠(哈巴狗)页面,我正在尝试将按钮的 id 传递到下一页。我尝试过 javascript,但它不起作用。
这是我的代码
script.
var test = function() {
console.log('button clicked!')
}
.container
table.tabSearch(border='0' )
tr
td
h3 Barre de recherche :
td
input#Search(type='search' name='q' aria-label='Search through site content')
td
input#BtnSearch(type='submit' onclick="#" value='Rechercher')
table.tableCat(border='0')
tbody
each dr,index in data
if index % 3 == 0
tr
td
.card
img(src='https://cdn.glitch.com/49ffbc5c-e916-4b9d-bc7c-920348ff00c3%2F3381.jpg?v=1627158038684' alt='tapis rouge' style='width:100%')
h1.title=dr.Nom
p.price=dr.Prix + "$"
p.description=dr.Description
p.dimension=dr.Dimension
p
a(href='detailCatalogue')
button#dr.codeProduit(onclick='test()') Détail
.btn
a(href='feedback')
button Feedback
这是我的路线
router.get("/detailCatalogue", function(req, res, next) {
res.render("detailCatalogue");
});
基本上我想要的是每当我点击时button#dr.codeProduit
,我希望能够提取按下了哪个按钮。
解决方案
推荐阅读
- swift - 在更新 ObservedObject 时更新 Picker
- javascript - Javascript .indexOf 匹配的 HTML 符号
- java - Creating a new window on button click - Vaadin14
- mysql - Why does this query suddenly return no results when adding more parameters in an IN clause?
- paypal-sandbox - While subscribe a user I got eror code 91927 in braintree using node js
- c - 使用指针打印二维数组时出错
- angular - 具有嵌套对象的 Angular Material 中的默认排序
- android - 发布多个 MutableLiveData 没有顺序
- python - 按数据分组到详细数据
- javascript - 我的代码有什么问题 - 它没有关闭