Knockout附加到类绑定(Knockout append to class binding)

编程入门 行业动态 更新时间:2024-10-24 14:19:12
Knockout附加到类绑定(Knockout append to class binding)

我正在使用Knockout,wijmo和Jquery验证。 作为正确工作的jquery验证要求的一部分,必须分配所需的类。 当使用knockout完成此操作时,它将覆盖wijmo指定的类。 因此放弃任何花哨的CSS。 我想在课堂上附加要求。

Knockout正在使用模板从数据库中分配正确的输入。

<script type="text/html" id="WijmoTextAreaControl"> <textarea rows="5" data-bind="wijtextbox: {}, value: Value, wijtooltip: {title: 'Tooltip should be linked to an observable'}, attr: {placeholder: DatabaseName.PlaceholdText, class: DatabaseName.class}" /> </script>

class:binding用必需的替换wijmo类。 无论如何都要将类信息附加到绑定。

I'm using Knockout, wijmo, and Jquery Validation. As part of the requirement for jquery validation to correctly work one must assign the class required. When this is done using knockout it overrides the class assigned by wijmo. Hence dropping any fancy css along with it. I would like to append required to the class.

Knockout is using templates to assign the correct input from the database.

<script type="text/html" id="WijmoTextAreaControl"> <textarea rows="5" data-bind="wijtextbox: {}, value: Value, wijtooltip: {title: 'Tooltip should be linked to an observable'}, attr: {placeholder: DatabaseName.PlaceholdText, class: DatabaseName.class}" /> </script>

the class: binding replaces the wijmo class with required. Is there anyway to append the class information to the binding.

最满意答案

对于assigninn类,你应该使用css绑定而不是attr 。

<textarea rows="5" data-bind="wijtextbox: {}, value: Value, wijtooltip: {title: 'Tooltip should be linked to an observable'}, attr: {placeholder: DatabaseName.PlaceholdText}, css: {'Your class name': true}" />

You should use css binding instead of attr for assigninn class.

<textarea rows="5" data-bind="wijtextbox: {}, value: Value, wijtooltip: {title: 'Tooltip should be linked to an observable'}, attr: {placeholder: DatabaseName.PlaceholdText}, css: {'Your class name': true}" />

更多推荐

wijmo,class,Knockout,required,using,电脑培训,计算机培训,IT培训"/> <meta name

本文发布于:2023-08-04 10:49:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1414041.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:绑定   Knockout   append   binding   class

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!