JQuery Learning(2):JQuery syntax

来源:互联网 发布:windows.old删除不干净 编辑:程序博客网 时间:2024/06/15 07:22
 With JQuery, you can select the HTML element,and perform operations.

JQuery syntax examples

$(this).hide()

demonstrate the JQuery hide() function,hide current HTML elements.

 

$("#test").hide()

demonstrate the JQuery hide() function,hide id="test" elements.

 

$("p").hide()

demonstrate the JQuery hide() function,hide the all "p" elements.

 

$(".test").hide()

demonstrate the JQuery hide() function,hide class="test" elements.

JQuery syntax

JQuery syntax forthe selection of HTML elements prepared,can be perform operations.

Basal syntax is:$(selector).action()

  • Dollar sign define jQuery
  • Selector sign (selector)query and find the HTML elements
  • JQuery's action perform operations for the elements

examples:

        $(this).hide()         ---       hide current elements

        $("p").hide()           ---       hide all "p" elements

        $("p.test").hide()   ---       hide all class ="test"  "p" elements

        $("#test").hide()    ---       hide all id='test' elements         

Cue:JQuery uses the xpath syntax with the CSS selector syntax combination.
原创粉丝点击