开发者

How do you set or remove generated label styles from the jQuery Validation plugin?

开发者 https://www.devze.com 2023-01-08 20:01 出处:网络
This is probably something simple I\'m just missing from the documentation and examples, but I\'m trying to remove a style from the generated label that appears when a field is invalid.

This is probably something simple I'm just missing from the documentation and examples, but I'm trying to remove a style from the generated label that appears when a field is invalid.

This is what I'm getting for a generated label:

<label style="display: inline;" class="error" generated="true" for="FirstName">

What I want is:

<label class="error" generated="true" for="FirstName">

Th开发者_如何转开发e frustrating part about this for me so far is when I review the examples, I'm not seeing anything that makes me think that the display: inline style is the default behavior.

I'm not doing anything fancy with my implementation. I've added a few validation methods, and have this for the errorPlacement:

   errorPlacement: function(error, element) {
                error.insertAfter(element.siblings("label"));
     }

EDIT:

I've discovered that this is happening only on one of my views.

I also found out that if I hard code the error labels:

<label for="FirstName" class="error" generated="false" style="display:block;"></label>

The system re-writes the style to be display:inline.

Is there something related to asp.net MVC that would be re-writing these styles like this on one of the views? Or would there be some condition that would force the jQuery validation plugin to do this?

0

精彩评论

暂无评论...
验证码 换一张
取 消