首页 \ 问答 \ 使用Select2 4.0和Bootstrap 3+设计jQuery验证样式(Styling jQuery Validation with Select2 4.0 and Bootstrap 3+)

使用Select2 4.0和Bootstrap 3+设计jQuery验证样式(Styling jQuery Validation with Select2 4.0 and Bootstrap 3+)

我有一个使用Bootstrap 3.3.4,Select2 4.0和Jquery Validation 1.13.1的项目

我已经设置了jquery验证器的默认样式bootstrap 3类就像这样

 $.validator.setDefaults({
    errorElement: "span",
    errorClass: "help-block",

    highlight: function (element, errorClass, validClass) {
    $(element).addClass(errorClass);
        $(element).closest('.form-group').removeClass('has-success').addClass('has-error');
    },
    unhighlight: function (element, errorClass, validClass) {
    $(element).removeClass(errorClass);
        $(element).closest('.form-group').removeClass('has-error').addClass('has-success');
    },

    errorPlacement: function(error, element) {
        if(element.parent('.input-group').length) {
           error.insertAfter(element.parent());
        } else {
            error.insertAfter(element);
        }

    }
});

但是,这些默认值不会在下图中设置相同的select2字段...,“金属”选择是引导字段,而“颜色”选择是select2字段。

在这里输入图像描述

我尝试搜索其他SO,但所有这些都使用select2的3.5.xx版本

我包含了一个图片示例的jsfiddle,我正在寻找对验证器默认值的调整,以使select2看起来统一

http://jsfiddle.net/z49mb6wr/


I have a project that uses Bootstrap 3.3.4, Select2 4.0, and Jquery Validation 1.13.1

I have set the jquery validator defaults to style bootstrap 3 classes like so

 $.validator.setDefaults({
    errorElement: "span",
    errorClass: "help-block",

    highlight: function (element, errorClass, validClass) {
    $(element).addClass(errorClass);
        $(element).closest('.form-group').removeClass('has-success').addClass('has-error');
    },
    unhighlight: function (element, errorClass, validClass) {
    $(element).removeClass(errorClass);
        $(element).closest('.form-group').removeClass('has-error').addClass('has-success');
    },

    errorPlacement: function(error, element) {
        if(element.parent('.input-group').length) {
           error.insertAfter(element.parent());
        } else {
            error.insertAfter(element);
        }

    }
});

But these defaults do not style select2 fields the same... in the image below, the "metals" select is a bootstrap field, while the "colors" select is a select2 field.

enter image description here

I tried searching other SO's , but all of these use the 3.5.xx version of select2

I included a jsfiddle of the example pictured, I am looking for adjustments to the validator defaults to have select2 look uniform

http://jsfiddle.net/z49mb6wr/


原文:https://stackoverflow.com/questions/30783019
更新时间:2024-02-14 07:02

最满意答案

那么,就像使用C ++代码一样。

只有非模板部分可以预编译。 其他一切必须提供完整的源代码。

作为共享库或静态库的Phobos在这里没有多大区别。 由于dmd与共享库的问题,它仍然是静态的。


Well, it's the same issue like with C++ code.

Only the non-templated parts can be precompiled. Everything else must be provided with full source code.

Phobos being a shared or static library doesn't make much difference here. It's still static because of dmd's issues with shared libraries.

相关问答

更多
  • soname用来表示你的库支持什么样的二进制api兼容性。 在编译时由链接器使用SONAME来从库文件中确定实际的目标库版本。 gcc -l NAME将寻找lib NAME .so链接或文件,然后捕获它的SONAME,这肯定会更具体(如libnuke.so.0.1.4的libnuke.so链接,其中包含SONAME libnuke.so.0)。 在运行时,它将与此链接,然后设置为ELF动态节NEEDED ,然后应该存在具有该名称的库(或指向它的链接)。 在运行时, SONAME被忽略,所以只有链接或文件存在 ...
  • 通常,您还需要安装包的主体(在您的情况下为numerics.adb)。 此外,我怀疑你想将ALI文件(numerics.ali)设置为只读,以便gnatmake不会尝试重新编译它们。 In general, you need to install the body of the packages as well (numerics.adb in your case). Also, I suspect you want to set the ALI files (numerics.ali) as read-o ...
  • 那么,就像使用C ++代码一样。 只有非模板部分可以预编译。 其他一切必须提供完整的源代码。 作为共享库或静态库的Phobos在这里没有多大区别。 由于dmd与共享库的问题,它仍然是静态的。 Well, it's the same issue like with C++ code. Only the non-templated parts can be precompiled. Everything else must be provided with full source code. Phobos be ...
  • “该项目适用于调试和发布中静态链接的所有库。” 那不是你的答案吗? 动态链接对这种情况有什么好处? I found a solution but I don't know why it works. There would be an explanation if all the functions (instead of just the one) that were defined in the header gave the linking error, but no, there are only ...
  • 这是解决这个问题的正确方法吗? 是的。 由于bar (共享)与foo (静态)链接,因此bar和foo必须使用与位置无关的代码进行编译。 CMake知道bar是一个共享库,并默认启用与位置无关的代码 。 但由于foo是一个静态对象,即使它可能会猜测它需要为PIC 1 ,但它并不会为foo默认启用PIC。 根据SO的问题CMAKE添加-fPIC编译器选项的习惯用法是什么? 您可以在所有目标上设置与位置无关的代码属性: set(CMAKE_POSITION_INDEPENDENT_CODE ON) 或在特定的 ...
  • 回溯代码使用与dladdr大致相同的机制来确定函数名称。 如果您的库是使用链接器映射文件(定义正在导出的内容,可用于限制所有其他项的可见性)构建的,或者使用显式可见符号-fvisibility=hidden ,那么它会使符号模糊它们不会出现在回溯输出中。 解决方法是在不使用限制库中所有符号可见性的映射文件的情况下进行编译,或使用-fvisibility=default进行构建。 这将使您无需代表您的任何努力回溯工作。 要在不执行此操作的情况下使其工作,您需要从.so加载本地符号表,并使用类似于addr2li ...
  • 尝试软链接 ln -s /usr/lib64/libcrypto.so.10 / lib 如果有帮助,请告诉我们。 或者您可以使用yum再次删除和安装。 通常,库文件在使用yum安装时会放置到其适当的位置。 yum删除dns-utils yum install dns-utils 您可以启用epel存储库,以备不时之需 try a soft link ln -s /usr/lib64/libcrypto.so.10 /lib Let us know if that helped you. Or you ca ...
  • 看来/usr/local/lib不在/etc/ld.so.conf或/etc/ld.so.conf.d/* 。 如果只是运行sudo ldconfig (或以root身份运行sudo ldconfig )并再试一次。 如果不是,请添加它或手动覆盖命令的库路径: LD_LIBRARY_PATH=/usr/local/lib ./myprogram 看起来您的配置看起来很奇怪,请检查/usr/local/lib/libgmp.so.10是否为/usr/local/lib/libgmp.so.10.0.2的链接 ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。