I am trying to wrap my head around plugins. The code I am converting is as follows:
function parseNum(str) {
var mdy = str.split('/')
return new Date(mdy[2], mdy[0]-1, mdy[1]);
}
function daydiff(first, second) {
return (second-first)/(1000*60)
}
$("#p").text((daydiff(parseNum($('#first').val()), parseNum($('#second').val()))));
This is what I have so far
;(function ($) {
$.fn.myPlugin = function (options) {
// define defaults
var defaults = {
x1: 2/27/2013,
x2: 2/29/2013
};
var o = $.extend(defaults, options);
What do I write inside the plugin and how to call it to populate $(#p).text()?