jQuery ?? ??
??? ?? ??? ??? ?? ???, ???? ??? ?? ??? ?? ??? ?????. ??? ?? ??? ?? ? ?? ??? ?? ??? ????, ?? ????? ?? ?? ??, ? ?? ?? ?? ??? ?? ????? ?????. ???? jQuery? ? ?? ??? ?????. I? ?? ?? ?? ??? ???? ? ??? ? ????.
??? ??:
?? ?? ?? ????? ??? ??? ??? ??? ?? ??? ???? ? ?????.
? ?? ?? ?? ?? HTML ???? ?????. ????? ???? ? ?? ??? ?? ???? ? ???? DOM ??, ?? ?? ?? jQuery ??
? ?? ??(div1,div2,...) ??? ???? ?? ????? ?????. ???? ??? ??
??:
?? ?? html ??? ??? ? ?? ?? ??? ??? ?? ??? ?? ??? ? html ??? ?????
html ??? ???? ? ??? ?? ??? ??? ???? ?? ??? ??? ???? ?? ??? html ??? ??? ?????.
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> <script src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script> </head> <body> <input id="bt1" type="button" value="after"> <input id="bt2" type="button" value="before"><br> <div>php 中文網(wǎng)</div> <script> $("#bt1").click(function(){ $('div').after('歡迎來(lái)到php中文網(wǎng)<br>'); }) $("#bt2").click(function(){ $('div').before('php.cn</br>'); }) </script> </body> </html>
???, ???. ?? ???? after ??? ???? div ?? ???? ?????. ?? ???? ??? ???.