1
function divFunction() {
$('#edit-modal').modal();
}
如何在此代碼中添加事件?我曾經試過,但它顯示在Firefox的錯誤:如何爲此代碼專門爲(.preventDefault())和停止傳播添加事件
typeerror: event undefined
function divFunction(event) {
event.stopPropagation();
var postBody = event.target.parentNode.parentNode.childNodes[1].textContent;
$('#post-body').val(postBody);
$('#edit-modal').modal();
}
這是我如何調用該函數:
@if(Auth::user()== $post->user)
<a href="#" name="edit" class="edit" onClick="divFunction()">Edit | </a>
<a href="{{ route('post.delete', ['post_id' => $post->id]) }} ">Delete | </a>
@endif
您是如何使用該功能的? – charlietfl
如何調用'divFunction()'函數? –
@if(AUTH ::用戶()== $後>用戶) Edit | Delete | @endif –