简体   繁体   English

通过jquery使用类时,消除Visual Studio 2008中的CSS警告

[英]Eliminating CSS warnings in Visual Studio 2008 when class is used via jquery

I have a few places where I use a class via jquery - for example, to add the datepicker to a text file, my textbox declaration looks like: 我有几个地方通过jquery使用类 - 例如,要将datepicker添加到文本文件,我的文本框声明如下所示:

<asp:TextBox ID="dateField" runat="server" CssClass="fieldSmall datePicker" />

However, this leads to a warning in VS2008 that the datePicker "class or CssClass value is not defined" 但是,这导致在VS2008中警告datePicker“类或CssClass值未定义”

I doesn't feel right to create an emply CSS class just to elminiate this warning. 我觉得创建一个emply CSS类只是为了消除这个警告是不对的。 Is there another way to do it? 还有另一种方法吗?

You'll need to turn off HTML Validation: 您需要关闭HTML验证:

  • Tools > Options > Text Editor > HTML > Validation 工具>选项>文本编辑器> HTML>验证
  • Uncheck the "Show Errors" check box. 取消选中“显示错误”复选框。

And CSS file error detection: 和CSS文件错误检测:

  • Tools > Options > Text Editor > CSS > CSS Specific 工具>选项>文本编辑器> CSS> CSS特定
  • Uncheck "Detect Errors" 取消选中“检测错误”

I handle it by creating an empty CSS class in a file I don't deploy in a released version like this: 我通过在文件中创建一个空的CSS类来处理它,我没有在这样的发布版本中部署:

<% #if DEBUG %>
  <link href="<%= Url.Content("~/Content/style/jquery_style_classes.css") %>"
    rel="stylesheet" type="text/css" />
<% #endif %>

Then the jquery_style_classes.css contains simple empty classes 然后jquery_style_classes.css包含简单的空类

.datePicker {
}

.JqueryResizable {
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM