开发者

How to call the following function in JQuery

开发者 https://www.devze.com 2022-12-19 19:38 出处:网络
jQuery.fn.daterangepicker = function(settings){ var rangeInput = jQuery(this); //defaults var options = jQuery.extend({
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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号