How to call the following function in JQuery
jQuery.fn.daterangepicker = function(settings){
var rangeInput = jQuery(this);
//defaults
var options = jQuery.extend({
........
//function to format a date string
function fDate(date){
if(!date.getDate()){return '';}
var day = date.getDate();
It is being used as follow syntax
$('input').daterangepicker( {
dateFormat : "M d, yy",
May I know how I can call function fDate?开发者_StackOverflow社区
I try
$('input').fDate(....)
but it doesn't work.
I get
$("input").fDate is not a function
The first portion of the code are from date picking library http://www.filamentgroup.com/lab/date_range_picker_using_jquery_ui_16_and_jquery_ui_css_framework/
Looking over the code, you cannot call it from outside the local scope. To expose it (i.e. to be callable as $('input').fDate ()
, you need to attach it to jQuery.fn
.
精彩评论