简体   繁体   中英

Create a plugin in jquery to style each element separately

I am creating my first plugin in jquery. I have went through the basics and now I have started to work on it. My approach is simple. I want to allow users to style each element differently.

Eg

     $('#form').style({                         
      inputelement:{
         border:'red',
         color:'#dcdcdc'
      }
  });

Goal for this plugin is to allow users to style elements independently

inputelement will be the id of the element of my form. I want to apply styles to elements of a form.

I know it can be easily done using css, but I want to experiment with plugins in jquery.

I think this is some advanced concept which I am thinking of, but I need some sort of output like this.

As some of the commentators have mentioned, you are re-inventing the wheel here. You can achieve the same thing by this.

$('#form').children('input').css({..})
.children('label').css({..});

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