我需要改进复选框的onclick功能。单击复选框contenteditable
时,单元格应交叉。我怎样才能做到这一点?感谢您的回复。
我的简单代码如下:
<!DOCTYPE html>
<html>
<head>
<style>
table {
border-collapse: collapse;
margin: 100px;
}
table, td, th {
border: 1px solid black;
padding: 10px;
}
table td.crossed {
background-image: linear-gradient(to bottom right, transparent calc(50% - 1px), red, transparent calc(50% + 1px));
}
</style>
</head>
<body>
<table id="t1">
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
<tr>
<td>1.</td>
<td>
<input type="checkbox">
</td>
<td>
<input type="date" id="mydate">
</td>
<td contenteditable='true'></td>
</tr>
</table>
<script>
</script>
</body>
</html>
答案 0 :(得分:1)
由于缺少类或ID,您可以使用add_filter( 'woocommerce_get_price_html', 'custom_price_html', 10, 2 );
function custom_price_html( $price, $product ) {
if( $product->get_price() == 0 || $product->get_price() == '') {
$custom_text = '<p class="label_not_available">Not Available</p>';
}
return $price . $custom_text;
}
获取相应的元素:
querySelector
这仅适用于&gt; IE8