【发布时间】:2019-04-22 00:38:54
【问题描述】:
在我的网站上单击按钮后,我想显示允许用户添加意见的新表单。我不确定应该以哪种方式将 jquery 脚本添加到我的项目中。我在简单的 html 网站上尝试过它并且它可以工作,但我不能对烧瓶应用程序做同样的事情。这是我的代码:
% extends "bootstrap/base.html" %}
{% block content %}
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/redmond/jquery-ui.css">
<script src="http://ajax.googleapis.com ajax/libs/jquery/1/jquery.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.js"></script>
<script type="text/javascript">
$(function () {
$("#btnclick").click(function () {
$("#divpopup").dialog({
title:"Dodaj opinie",
width: 430,
height: 200,
modal:true,
buttons: {
Close:
function(){
$(this).dialog('close');
}
}
});
});
})
<div id="divpopup" style="display: none">
Here will be form
</div>
<button type="button" id="btnclick">Add opinion</button>
{% endblock %}
点击按钮后什么也没发生。我用的是bootstrap和jinja2,要不要用其他的内容来添加脚本?
【问题讨论】:
标签: javascript jquery twitter-bootstrap jquery-ui