What the $(“#?

Here’s a great question from the web board. What is it with the $(“# you will sometimes see in the code?

It’s a jQuery thing. Valid function names can start with a letter or certain special characters. “$” is a valid character to use in a function name. In this case, it’s the entire function name: $().

(jQuery is a utility library which is included in AppStudio apps)

jQuery’s $() function is a selector. It looks for elements in your app. It has a lot of different ways to select them:
http://api.jquery.com/category/selectors/

You may see something like

  $("#Button1").css("color","red")

The # means to look for an element with the id of “Button1”. What follows is the function to perform on the selected elements. There are a lot of functions that can be called:
http://api.jquery.com

By the way, you can also do the above as follows:

  $(Button1).css("color","red")

Rather than using a selector, we reference the control directly.

This entry was posted in css, tips. Bookmark the permalink.