JQuery原生代码:
[sourcecode]
This is id paragraph.
This is class paragraph.
[/sourcecode]
haxe实现:
[sourcecode]
package ;
import js.JQuery;
import js.Lib;
/**
* ...
* @author amyflash.com
*/
class Main
{
static function main()
{
new JQuery(null).ready
(
function(e:JqEvent)
{
var domElem = new JQuery("button");
var clickHandlerFunction = function (e)
{
//隐藏class="test"的元素
var d = new JQuery(".test");
d.hide();
//隐藏id="test"的元素
var d2 = new JQuery("#test");
//d2.hide();
d2.css("background-color","red");//p背景变红色
}
domElem.bind( "click", clickHandlerFunction );
}
);
}
}
[/sourcecode]
对应的html文件:
[sourcecode]
This is id paragraph.
This is class paragraph.
[/sourcecode]