-1

I´m reading a Polymer tutorial but I don't understand some code lines, like this:

 postTask: function(e) {  // Add a new task
    var tsk = this.$.tTask.value;
    var usr = this.$.tUser.value;
    ...

In this code block I don't understand the selector this.$.tTask.value, is another way to select in jQuery syntax?

1
  • 1
    Note that $ is a valid JavaScript identifier name. It is the same used by jQuery by coincidence (mostly because it is easily distinguished). It is nothing more that this.EasyToRememberVarName.tTask.value. You should look into Polymer documentation for more accurate description. Commented Feb 21, 2016 at 9:55

1 Answer 1

4

I know nothing about Polymer, so I can only answer this question based on javascript syntax.

This code doesn't necessarily involve jQuery.

In javascript, the $ symbol is just an identifier.

When you include jQuery, it happens to assign the jQuery function to window.$. But jQuery does not 'own' the $ symbol.

Here, a variable with the identifier of $ has been assigned to the current object. For example, some code somewhere could be calling

this.$ = {
      tTask: { value: "TaskValue" },
      tUser: { value: "UserValue" }
};
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.