此 html 表单由一些 javascript 代码显示。现在我想在我单击表格中的单元格时将其信息添加到这种警报中。
我该怎么做?
<div class='alertBox' id='box'>
<script type="text/javascript">
$(document).ready(function() {
$('#tableBody td').on('click', function() {
alert($(this).html() + ' ' + months[currentMonth] + ' ' + currentYear);
});
});
</script>
<form>
<input name='Event' type='text' value='Event'> <br>
</form>
<a onclick='unpop()' class='close'>Close</a>
</div>
...
这是一个网站,您可以在其中将约会添加到日历,之后约会将由树莓派显示。
最佳答案
谢谢您的回答。 我已经找到了另一个解决方案。 如果您有兴趣,请看这里:
$(document).ready(function() {
$('#tableBody td').on('click', function() {
var cellIndex = document.getElementById('displayDate').innerHTML = $(this).text() + ' ' + months[currentMonth] + ' ' + currentYear;
});
});
function pop() {
document.getElementById('box').style.display = 'block';
cellIndex;
}
function unpop() {
document.getElementById('box').style.display = 'none';
}
关于javascript - 如何将 jQuery 信息添加到 html 表单?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55425097/