Tuesday, May 1, 2012

jQuery and Windows 8 JavaScript Metro Style Apps


Can jQuery be used in Windows 8 Metro Style apps developed using the JavaScript API? I'm looking at the samples, and there a lot of standard DOM manipulation like document.getElementById , addEventListener , etc. I'd like to use jQuery for productivity.



Source: Tips4all

4 comments:

  1. The $ is not magic. jQuery is just a javascript library. It should run fine.

    The only thing that might not work are cssHooks which won't take into account any 'quirks' of their environment.

    So yes, it will work, if you trust Microsoft to produce an environment that follows the HTML/CSS/JS specifications.

    Do you feel lucky?

    ReplyDelete
  2. It should run fine. jQuery is just a library. The $('#someid') will internally call the document.getElementById You can use it just as if you can use the javascript code you write yourself...

    ReplyDelete
  3. Yes, it works, as will any JavaScript library. I verified it on one of the tablets they gave out at the BUILD conference.

    However, do not expect to use a CDN to load in the script. You have to download it, add it to the project, and reference it locally.

    ReplyDelete
  4. You can use any JS library. I suspect that methods like WinJS.xhr (aka '$.ajax') where written so that WinJS doesnt have a dependency on jQuery.

    ReplyDelete