Are you first timer at lazacode.org? Why not join us and start exchange your programming knowledge with everyone. Register today!

jQuery Syntax

0 votes
19 views
added Apr 5 in jQuery by LC Marshal Lieutenant (14,830 points)

Example 1.

$(function() {
  var expiry = $('span.expiry_msg');  
  if ($(expiry).length) { 
   $(expiry).clone().appendTo('#footer > span.expiry-msg').addClass('footer-expiry').fadeIn(500);
  }
});
$(function() { ... });

is just jQuery short-hand for

$(document).ready(function() { ... });

1 Response

0 votes
responded May 16 by LC Marshal Lieutenant (14,830 points)

to apply same method to more than 1 variables

var viewQ = $('.tabs--primary.nav.nav-tabs li:first-child'),
    commentTitle = $('#comment-body-add-more-wrapper label.control-label'),
    editPreview = $('#edit-preview');

viewQ.add(commentTitle).add(editPreview).hide();
lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...