Skip to main content

Customizing Date Displays with jQuery

  • Chapter
  • First Online:
  • 1347 Accesses

Abstract

One of richest opportunities for customizing SharePoint functionality is by using JavaScript and, in particular, the popular open source library, jQuery. At the Air Force Academy, we added it as well as the jQuery UI set of controls to our master pages, making the libraries available on every page in our environment. I won’t do that with these Office 365 examples, but it is fairly easy to link to them directly.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   29.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Notes

  1. 1.

    Learn more, download, contribute, and read the documentation at http://jquery.com.

  2. 2.

    jQuery UI allows you to “skin” controls with a standard or customized theme. I’ve used the Button and Dialog controls extensively in SharePoint and the rest of the controls in other applications. We cover this in the next chapter. Visit http://jqueryui.com to learn more.

  3. 3.

    This is the main reason to use jQuery rather than JavaScript on its own. jQuery makes it very easy to find elements by their attributes. For example, say you had this div: <div id="xyz"></div>. You could reference it programmatically via JavaScript like this: var elementId = document.getElementById(“xyz”);. With jQuery, it is easier with this syntax: var elementId = $(“#xyz”);.

  4. 4.

    DOM stands for Document Object Model, which is basically all the HTML on the page.

  5. 5.

    You need to use the Developer Tools to count them since one of the columns does not show up on the screen and the other one holds the menu (…). Note that we start counting at 1 in this case (unlike many programming contexts where we start from 0).

  6. 6.

    The . at the beginning of .alert means that this is a class. A # means that we match an id, while no punctuation such as tr means that the style applies to all elements of that type.

  7. 7.

    Be sure to use an https:// link. My first version with an http:// link failed for security reasons.

  8. 8.

    This is important since otherwise the JavaScript code might look for HTML elements that have not yet been loaded and thus are not available for interaction or changing.

  9. 9.

    Recall that we changed the column settings to show a standard display. This step would have failed if we had a column value of April 1 or Yesterday.

  10. 10.

    I usually call it Code Library so that it doesn’t get mixed up with other documents.

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2019 Jeffrey M. Rhodes

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

Cite this chapter

Rhodes, J.M. (2019). Customizing Date Displays with jQuery. In: Creating Business Applications with Office 365. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-5331-1_3

Download citation

Publish with us

Policies and ethics