如果变量值丢失则隐藏按钮

问题描述 投票:0回答:1
javascript
1个回答
0
投票
myTBody2 += `<tr>`;
// check if href is not empty string:
if(data._links.first.href.length){
myTBody2 += `<td><button class="btn btn-sm btn-primary" onclick="myFetcher('${data._links.first.href}')">First</button></td>`
}

//...same for the others..

myTBody2 += `</tr>`;
© www.soinside.com 2019 - 2024. All rights reserved.