是否可以使用pug表单下拉列表作为使用节点的另一个pug模板的链接?我研究发现:
.form-group
label
select(name='region' placeholder="region" id="reg")
option(value='/volta') v
option(value='/accra') a
option(value='/eastern') e
option(value='/oti') o
option(value='/savanna') s
script.
var urlmenu = document.getElementById( 'reg' )
urlmenu.onchange = function() {
window.open( this.options[ this.selectedIndex ].value )
/ volta等是模板。这似乎不起作用
我猜这里只是语法问题,已解决,这使您的代码可以工作。
select(name='region' placeholder="region" id="reg")
option(value='/volta') v
option(value='/accra') a
option(value='/eastern') e
option(value='/oti') o
option(value='/savanna') s
script.
var urlmenu = document.getElementById('reg');
urlmenu.onchange = function() {
window.open( this.options[ this.selectedIndex ].value )
//or
//window.location.href = this.options[ this.selectedIndex ].value
}