You have to extend the defaults before you are doing something with
these:

$.fn.testFrame = function(options) {
    var defaults = {
      urlSuffix: '',
      iframe: 'body'
    };

    options = $.extend(defaults, options);
   ....

On 27 Oct, 07:57, Nic Hubbard <[EMAIL PROTECTED]> wrote:
> I have a small plugin that creates an iframe, and lets links open
> within the iframe.  The default is to append the iframe to the body,
> but I wanted the user to be able to pass in an ID and have the iframe
> append to that.  Sounded easy enough, but it is not working for some
> reason.
>
>   $.fn.testFrame = function(options) {
>     var defaults = {
>       urlSuffix: '',
>       iframe: 'body'
>     };
>
>     $(defaults.iframe).append('<iframe name="assetEditFrame"
> id="assetEditFrame" scrolling="no" frameborder="0"></iframe>');
>
>     var options = $.extend(defaults, options);
>
>     return this.each(function() {
>
>       var obj = $(this);
>       var itemId = obj.attr('id');
>       var itemHref = obj.attr('href');
>
>       obj.attr('target', 'assetEditFrame');
>       obj.attr('href', itemHref + defaults.urlSuffix);
>     });
>   };
>
> Everytime I add $('p').testFrame({iframe: '#content'}); it won't pass
> #content, and allow the iframe to be created there, it just uses the
> default each time.  Have I done this incorrectly?

Reply via email to