jQuery / JS objects each conversion

A, js objects into jQuery Object: Use $ () DOM object to wrap up;

  var v = document.getElementById ( "v"); // js objects

  var $ v = $ (v); // jQuery objects

Two, jQuery objects into js objects:

  ( 1 ) Since jQuery a dummy array, with [index] Method obtained:

    var $ v = $ ( "# v"); // jQuery objects;

    var v = $ v [0]; // js subject;

    alert (v.checked) // detect whether the checkbox is checked;

  ( 2 ) by jQuery itself .get (index) Method:

    var $ v = $ ( "# v"); // jQuery objects;

    var v = $ v.get (0); // js subject;

    alert (v.checked) // detect whether the checkbox is checked;

Guess you like

Origin www.cnblogs.com/Tractors/p/11094304.html