Calling JQuery Plugin

I'm new to Jquery and have been following some tutorials but this has me stuck. I found a tutorial to make a Jquery clock that works great but I'm trying to convert it to a plugin. The problem I'm having is I have seen how to call a plugin based on a singe div but this has me stumped. Could you have a look at the code for me and show me how I would go about calling the plugin? Thanks


    <script src="jquery.min.js"></script>
    <script src="clock.js"></script>
        // Need to call


            #clock {
              position: relative;
              height: 285px;
              margin: 20px auto 0 auto;
              background: url(images/clockface.png);
              list-style: none;

            #sec, #min, #hour {
              position: absolute;
              width: 7px;
              height: 70px;
              top: 125px;
              left: 140px;

            #sec {
              background: url(images/second.png);
              z-index: 3;

            #min {
              background: url(images/min.png);
              z-index: 2;

            #hour {
              background: url(images/hour.png);
              z-index: 1;
    <ul id="clock"> 
      <li id="sec"></li>
      <li id="hour"></li>
      <li id="min"></li>


$.fn.mclock = function(){
    var defaults = {
        var seconds = new Date().getSeconds();
        var sdegree = seconds * 6;
        var hdegree = hours * 30 + (mins / 2);
        options = $.extend(defaults, args);

      setInterval( function() {
  var seconds = new Date().getSeconds();
  var sdegree = seconds * 6;
  var srotate = "rotate(" + sdegree + "deg)";

  $("#sec").css({ "transform": srotate });

  }, 1000 );

  setInterval( function() {
  var hours = new Date().getHours();
  var mins = new Date().getMinutes();
  var hdegree = hours * 30 + (mins / 2);
  var hrotate = "rotate(" + hdegree + "deg)";

  $("#hour").css({ "transform": hrotate});

  }, 1000 );

  setInterval( function() {
  var mins = new Date().getMinutes();
  var mdegree = mins * 6;
  var mrotate = "rotate(" + mdegree + "deg)";

  $("#min").css({ "transform" : mrotate });

  }, 1000 );    })(jQuery);


UPDATE: Stripping back to hello world revealed missing brace }

NOTE: You aren't return(ing) this.each which might break your plugin

Skeleton plugin

 * Released under the MIT License


$.fn.PLUGIN_NAME = function(options) {

    var opts = $.extend({}, $.fn.PLUGIN_NAME.defaults, options);

    return this.each(function() {



$.fn.PLUGIN_NAME.defaults = {


Need Your Help

Batch modify text files

regex markdown batch-processing

I have a million markdown files spread across several sub-directories files with different titles where I want to change:

cassandra load distribution - uneven 1.2.8

cassandra ycsb

I am having a 4 node cluster setup of apache-cassandra-1.2.8 and trying to load about a 25 million of records. The cluster is setup with the default (murmur) partitioning and assigned tokens based ...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.