CIS196 Web Development II Archives

Monday
Jan312011

A Final Answer

OK, we have a final, definitive answer for the question of the .data() arguments question.

Sunday
Jan302011

jQuery 1.4.4 VS Docs

The Visual Studio documentation file for jQuery 1.4.4 can be downloaded here.

Saturday
Jan292011

Visual Studio Extension I Use at Home

JScript Editor Extensions (free)

This one adds four new features to Visual Studio:

  • Brace matching
  • Code outlining and folding
  • Current word highlighting
  • IntelliSense comments

CodeRush

An amazing productivity add-on for Visual Studio. Be sure to watch the demo video on this page. 
There's also a free express version you can try available here with its own demo video here.

Tuesday
Jan252011

Updates from Class

As far as I can tell, the reason we couldn't get the initial demo to work properly is that the book is incorrect: the .data() function does not allow a function for its value parameter. To obtain the effect we were looking for you would need code as follows:

$(function () { // document ready handler
  $('li').each(function (i) {
    $(this).data('data-joe', $(this).text())
  })
  
  $('li').click(function () {
    alert($(this).data('data-joe'));
  })
});

Or, even better...

$(function () { // document ready handler
  $('li').each(function (i) {
    $(this).data('data-joe', $(this).text())
  }).click(function () {
    alert($(this).data('data-joe'));
  })
});

I also had difficulty getting the wrap() family of functions to work. This is because I was putting them outside of the document ready hander and they were never being called. Calling the following code will result in a border around the unordered list on the page.

$('ul').wrap('
'); $('div.new').css({ borderStyle: 'solid', borderWidth: '5px' });

You can also use the following short-hand version:

$('ul').wrap('
'); $('div.new').css({ borderStyle: 'solid', borderWidth: '5px' });

On a final note, I've overheard some comments which lead me to believe that some of you are confusing the .data() method and the jQuery.data() method. See the documentation to refresh yourselves on the difference.

Friday
Jan212011

A Few Links for You

Tuesday
Jan112011

Applying CSS with jQuery

Here is the correct way to apply multiple CSS rules with one call to the .CSS() wrapper method. Note the JavaScript-style syntax for the normally dashed properties (font-weight becomes fontWeight and font-style becomes fontStyle). I've broken the statement across multiple lines for readability.

$("

Hi there!

") .css({color: 'red', fontWeight: "bold", fontStyle: "italic"}) .insertAfter("#followMe");
Tuesday
Jan042011

Designing Landing Pages

Tuesday
Mar162010

IE9 Preview: Now with HTML 5!

Saturday
Mar132010

Lynx Download

Click here to download a Windows-compatible, binary version of Lynx. Extract .zip the file to a folder and run the program from there. No installation needed.

Wednesday
Mar102010

Another Good HTML5 Read

This time from DailyTech. The InformationWeek interview is also worth reading.