使用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看起来统一
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.
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
原文:https://stackoverflow.com/questions/30783019
最满意答案
那么,就像使用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.
相关问答
更多-
用于学校教学的电脑网络教室,它的网络类型属于() A.互联网 B.广域网 C.城域网 D.局域网[2023-01-12]
d -
soname用来表示你的库支持什么样的二进制api兼容性。 在编译时由链接器使用SONAME来从库文件中确定实际的目标库版本。 gcc -l NAME将寻找lib NAME .so链接或文件,然后捕获它的SONAME,这肯定会更具体(如libnuke.so.0.1.4的libnuke.so链接,其中包含SONAME libnuke.so.0)。 在运行时,它将与此链接,然后设置为ELF动态节NEEDED ,然后应该存在具有该名称的库(或指向它的链接)。 在运行时, SONAME被忽略,所以只有链接或文件存在 ...
-
为Ada构建共享库(Building shared libraries for Ada)[2024-04-18]
通常,您还需要安装包的主体(在您的情况下为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 ... -
D中的模板和共享库(Templates and Shared Libraries in D)[2023-04-10]
那么,就像使用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 ...
-
找不到gmp共享库(gmp shared libraries not found)[2022-05-15]
看来/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的链接 ...