我的工具提示完美地在主页上工作.在稍后由ajax调用生成的模态中,模态将不起作用.
我在生成的模式中包含了以下代码(ajax调用的结果).
重新使用工具提示
<script>
$('.tooltips').tooltip();
</script>
Run Code Online (Sandbox Code Playgroud)
在模态的html中
<button class="btn btn-lg default tooltips blue-madison" type="submit"
name="O" data-container="body" data-placement="top"
data-original-title="THIS TEXT FOR TOOLTIPS">
<i class="fa fa-industry blue-madison"></i> BUTTON1
</button>
<button class="btn btn-lg default tooltips green-jungle" type="submit"
name="P" data-container="body" data-placement="top"
data-original-title="THIS TEXT FOR TOOLTIPS">
<i class="fa fa-user green-jungle "></i> BUTTON2
</button>
Run Code Online (Sandbox Code Playgroud)
为什么工具提示没有显示 - 我做错了什么?
我是那个新手,所以我很抱歉要求困惑和简单的想法:-)
我的JS代码不适用于具有从ajax-call和php端加载的表单的moadal.
我想我必须像这样调用函数
$(document).on('click', '#tags', function ()Run Code Online (Sandbox Code Playgroud)
我现在不知道如何将原始代码更改为此 - 也许有人可以帮助我并为我解释一下?
$('#tags').on({ click: function(e) {
e.preventDefault();
alert('geklickt');},
mouseenter: function(e) {
alert('mouse enter!');
}
});Run Code Online (Sandbox Code Playgroud)
如果我只使用"$('#tags')"它对我不起作用......
希望我能解释一下我想做什么.
除此之外,我终于重新编码了这段代码
$(document).ready(function() {
bookIndex = 0;
$('#bookForm')
// Remove button click handler
.on('click', '.removeButton', function() {
var $row = $(this).parents('.form-group'),
index = $row.attr('data-book-index');
// Remove fields
$('#bookForm')
.formValidation('removeField', $row.find('[name="book[' + index + '].title"]'))
.formValidation('removeField', $row.find('[name="book[' + index + '].isbn"]'))
.formValidation('removeField', $row.find('[name="book[' + index + '].price"]'));
// Remove element containing the fields
$row.remove();
});
});
Run Code Online (Sandbox Code Playgroud)
我必须改变哪些部分"document.on"支持是可以想象的?