Saturday, March 26, 2011
JQuery Hello world plugin
<div class="Test">
Hello world</div>
<script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.5.js" type="text/javascript">
</script>
<script type="text/javascript">
(function($)
{
$.fn.helloworld = function()
{
return this.each(function()
{
$('div').css('color', 'red');
alert('Hello world');
});
};
})(jQuery);
$('.Test').mouseover(function()
{
$('.Test').helloworld();
});
</script>
Hello world</div>
<script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.5.js" type="text/javascript">
</script>
<script type="text/javascript">
(function($)
{
$.fn.helloworld = function()
{
return this.each(function()
{
$('div').css('color', 'red');
alert('Hello world');
});
};
})(jQuery);
$('.Test').mouseover(function()
{
$('.Test').helloworld();
});
</script>
Reference:
Subscribe to:
Posts (Atom)