django - 将错误值传递给模板中的 JS 代码。姜戈
问题描述
我已经购买了其中一个 Bootstrap 模板。我正在尝试将视图或 forms.py 中的值传递给我的模板
<div class="input-group">
<textarea class="form-control" rows="4" name="text" placeholder="Hi there, I would like to ..." aria-label="Hi there, I would like to ..." required
data-msg="Please enter a reason."
data-error-class="u-has-error"
data-success-class="u-has-success"></textarea>
</div>
正是这个值data-msg="Please enter a reason."
我怎样才能做到这一点?将值传递给 JS 代码还是有可能?如何更改将由 JS 代码显示的消息的内容。
解决方案
推荐阅读
- javascript - 如何使用 React 在用户键入时更改输入部分的样式?
- sql - SQL DATEDIFF - 如何将值作为整数返回
- javascript - 如何在wordpress中进行条件下拉
- dataframe - 如何将 pyspark 数据框的列值转换为逗号分隔的字符串
- python - 更改包含工作日的日期时间格式?
- c - 如果我不设置'pthread_join',为什么线程会死
- python - 数据框左合并与不同列中的匹配键
- android - 除非在观察者方法中再次声明适配器,否则不会显示 recyclerview 中的项目
- laravel - Maatwebsite Excel - 如何命名多张工作表?
- ruby-on-rails-4 - Will_paginate,Ruby on Rails,条件