Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript my basic jquery not working Re: my basic jquery not working

#118239
SgtLegend
Member

Just a couple of nitpicks, the below is the recommended way of writing jQuery.

// This is the shorthand way of writing $(document).ready()
$(function() {
// Since jQuery 1.5 its now recommend you use the on() method
$(‘p’).on(‘click’, function() {
// Always use “this” as it referrers to the current element context not every p element
$(this).hide();
});
});