0
  $(':radio, :checkbox', this).wrap('<div style="margin: 1px"/>');
  $(this).buttonset();
  $('label:first', this).removeClass('ui-corner-left').addClass('ui-corner-top');
  $('label:last', this).removeClass('ui-corner-right').addClass('ui-corner-bottom');

as above, I can understand why there are 2 arg in a $? I has googled but still cannot find a related discuss

Ezra Ma
  • 37
  • 1
  • 5

1 Answers1

0

In this selector:

$(':radio, :checkbox', this)

this is the wrapper which contains radio and checkbox.

consider this example:

$('form').submit(function(){
   if(!$(':checkbox, :radio', this).prop('checked')){
      alert('please select checkbox and radio.');
   }
});

so in the above example $(':checkbox, :radio', this) this selector you can see it is in the context of $('form') so here this is actually form and you are trying to select the specific child of it.

This line is actually you can write like this too:

$(this).find(':checkbox, :radio')
Jai
  • 74,255
  • 12
  • 74
  • 103