$('#arch').on('click', function(){
var x='<p><a href="#" onclick="javascript:dispcontacts()" class="btn btn-lg btn-success" id="contacts" role="button">Fix a Appointment</a></p>'
$('#mydata').html(x);
});
function dispcontacts {
document.getElementById("mydata").innerHTML = "Contacts";
}
我无法拨打dispcontacts()
如何调用dispcontacts?
答案 0 :(得分:0)
你忘记了()
。它应该是
function dispcontacts() {
document.getElementById("mydata").innerHTML = "Contacts";
}
答案 1 :(得分:0)
您缺少函数paranthesis。它应该是
function dispcontacts()
{
...
}
以下是正确代码的jsbin链接: