简体   繁体   中英

How to style form elements unobtrusively with JavaScript and CSS?

如何在包括IE6在内的所有浏览器中毫不费力地为元素设置样式

There are a few plugins that do what you want. Basically, you want to add special styling to forms via javascript + css, but want the form to function normally if javascript is disabled

Here are two such plugins, but I am sure there are more out there:

  1. Uniform for jQuery on Github and The Overview
  2. FancyForm for MooTools

This new plugin works pretty well and is more robust than uniforms. http://customformsjs.com/

为您的元素使用类名称 ,这些元素通常无法在CSS中应用样式。

So far i found this is best and works in IE 6+, safari 2+, firefox 2+

http://www.dfc-e.com/metiers/multimedia/opensource/jqtransform/ 替代文字
(source: blogfreakz.com )

Use jQuery . Specifically the toggleClass function and then use CSS classes to style your forms. No plugin required. See jQuery Attributes Documentation .

If you want more styles, check out jQuery UI .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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