Adam,
You should be able to get away with:

$('#button').click(function(){
$('<a href="#></div>')
.appentTo('#div')
.text('Remove Me')
.click(function(){
$(this).remove();
//put more code here
return false;
});
});


On 8/12/07, Adam <[EMAIL PROTECTED]> wrote:
>
>
> Hi, I have a plugin which creates links dynamicly, this is all fine.
> The problem is I want to remove the links also but since the link is
> created dynamicly I can't used a simple $('a').click since it won't be
> there on first load. I need to somehow link to a function inside the
> plugin. Example code below.
>
> jQuery.fn.link = function(options){
>
>   var settings = jQuery.extend({
>     someSetting: 'Removed'
>   }, options);
>
>   // On Button click add link
>   $('#button').click(function()
>     {
>       $('#div').append('a href="javascript: void(0);"
> onClick="removeLink(this);">Remove Me</a>');
>     }
>   );
>
>   function removeLink(object)
>   {
>     object.remove();
>     alert(settings.someSetting);
>   }
>   return this;
> };
>
> So all I want to do as you can see is call the remove link function,
> but it must run using the plugin since I need to use some settings
> also in the removal. The code above is not the actual code just an
> example of its use. Is there anyway to call this remove function, for
> example if the plugin is created using $('body').link(); Can I call
> the removeLink function doing something like $
> ('body').link.removeLink(this);
>
>


-- 
Benjamin Sterling
http://www.KenzoMedia.com
http://www.KenzoHosting.com

Reply via email to