Monday, 30 May 2011

jQuery simplemodal plugin typeError: 'tagName' is null or not an object.

Many thanks for Eric's effort he made to create the great simple modal jQuery plugin.

http://www.ericmmartin.com/projects/simplemodal-demos/

I found a bug then fixed it, the bug is in $.modal.impl.create function , I think it is not new for you, where you mentioned the solution when you commented to use 'form' instead 'body' for the property appendTo.

First: the comment have to be modified to become {use '#aspnetForm'} instead of {use 'form'}
Second: in line number 344, there is still hard coding problem of the word 'body', as follows.

// add styling and attributes to the data
// append to body to get correct dimensions, then move to wrap
s.d.data = data
.attr('id', data.attr('id') || s.o.dataId)
.addClass('simplemodal-data')
.css($.extend(s.o.dataCss, {
display: 'none'
}))
.appendTo('body');


I replaced the hard coded word with s.o.appendTo object such like {.appendTo(s.o.appendTo);}, and everything goes right.


No comments:

Post a Comment