所以我有這個酥料餅這是工作好,這裏是酥料餅的HTML:如何將inline-javascript移動到腳本標記?
<div class="popover2" onmouseover="$(this).mouseleave(function() {$(this).hide(); });">
<div class="arrow"></div>
<div class="popover2-inner">
<span class="popover2-title">Popover() 2</span>
<div class="popover2-content">
<ul class="unstyled">
<li><span>$200 Bronze</span><p>2 hrs. drivers training</p </li>
</ul>
</div>
</div>
而且我得到這個實例代碼:
$('.popover2-test').popover({
placement:'bottom',
template: $('.popover2'),
trigger: 'manual',
animate: false,
html: true,
}).click(function(e) {
e.preventDefault() ;
}).mouseenter(function(e) {
$(this).popover('show');
});
但我想將內嵌的onmouseover javascript東西移動到實例化代碼中。我不知道該怎麼做。任何幫助都很好,謝謝。
給標籤中的ID,然後只需在綁定JS事件。除非那是該類的唯一標籤,在這種情況下,您可以簡單地使用該類。 – TheZ
你必須更具體,我不知道你在說什麼,對不起,謝謝! – dezman