English 中文(简体)
j Query fn 说“不是功能”
原标题:jQuery .fn is saying "not a function"

当我称之为这一习俗功能时,我会把这一功能称为这种习俗。

$.fn.inputBoxHelper = function () {
    var args = arguments[0] || {};
    var matchingElem = $.grep(this, function (e) { return $(e).val() == $(e).attr( title ); });
    $(matchingElem).addClass(args.className);

    this.bind({
        focus: function(){
            if ($(this).val().trim() == $(this).attr( title )) { $(this).val(emptyString).removeClass( gray ); }
        },
        blur: function(){
            if ($(this).val().trim() == emptyString) { $(this).val($(this).attr( title )).addClass( gray ); }
        }
    });
    return this;
}

$( input:text ).inputBoxHelper({ className:  gray  });

这给我带来了错误。

$("input:text,input:checkbox").inputBoxHelper is not a function
file:///D:/repository/scripts/script_tests/test.js
Line 20

即使在我改变职能时,也只是为了公正。

$.fn.inputBoxHelper = function () {return this;}

it does the same thing. It seems to run fine and work correctly as all the functionality works on the input boxes but get the error. Anyone have any ideas?

问题回答

检查你没有把酒类装上两页。 一些原始图书馆或原始图书馆,如j Query。 因此,它可以超越你现有的 j,超越<条码>和<条码>。 带有新鲜——新鲜——的金字塔/代码”变量,造成现有金块无法界定。 在定义时,插gin添加到 j的原型中。 因此,如果你销毁了该物体的唯一例子,那么该原型就会重新进入原样。 因此,这些金刚石不再是这一原型的一部分。

另外,JSLint报告说,你在该职能定义最后一行中再次失踪了半殖民地。 应:

$.fn.inputBoxHelper = function () {
  var args = arguments[0] || {};
  var matchingElem = $.grep(this, function (e) { return $(e).val() == $(e).attr( title ); });
  $(matchingElem).addClass(args.className);

  this.bind({
     focus: function(){
          if ($(this).val().trim() == $(this).attr( title )) { $(this).val(emptyString).removeClass( gray ); }
      },
      blur: function(){
          if ($(this).val().trim() == emptyString) { $(this).val($(this).attr( title )).addClass( gray ); }
      }
  });
  return this;
};

该公司通过德国航天公司管理所有优良思想。 它可以帮助你发现你可能想其他办法。

粉碎需要装上,才能使用。

以上评论证实,在装货之前,欧佩组织正试图使用该金。





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签