views:

195

answers:

4

I'm having trouble implementing this jQuery plugin for dynamic forms while following this tutorial

This simple code is giving me an error in Firefox 3.5.5.

$(document).ready(function(){  
    $('#duplicate').dynamicForm('#plus', '#minus', {limit:5});
});

and the error:
"$("#duplicate").dynamicForm is not a function"

There is an element in the HTML with id="duplicate" so I'm not sure what the error means.
Can anyone shed some insight on this issue?

+1  A: 

Have you included jquery-dynamic-form.js in the head section of your page after the inclusion of the jquery library itself:

<script type="text/javascript" src="jquery.js"></script>    
<script type="text/javascript" src="jquery-dynamic-form.js"></script>
Darin Dimitrov
Yes I have, and both are loading with no errors.
buken
A: 

@buken how do you know that both are loading with no errors?

That error says that there is no function defined with that name for jQuery object. Probably that plug-in has not loaded properly when you try to use it.

Try checking $().dynamicForm in firebug console. If plugin is loaded it should output normalizeElmnt(elmnt). Check with example downloaded from http://code.google.com/p/jquery-dynamic-form/downloads/list, does it work or throws error?

MBO
When I load the page no errors pop up related to jquery.js or jquery-dynamic-form.js in the net panel or the console in firebug. I can see that the version of jQuery is 1.3.2, the one that comes with the dynamicForm plugin. Typing `$().dynamicForm` into the console returns nothing at all.
buken
@buken Can you see jquery-dynamic-form.js in script tab? If no, then it didn't loaded. Or try changing `$` to `jQuery`, is it possible that `$` was overridden by some else library? I have no other ideas what could be wrong :-/
MBO
You're right. now that I check, the script didn't show up in the scripts tag, which should have tipped me off from the beginning.
buken
A: 

After many hours of hair-pulling, I've finally fixed the issue. The culprit? Misspelling "text/javascript" in the script tag.

I think I'll take a nap now. Thanks everyone for your help.

buken
A: 

Hello,

Sorry to post on the same message but I seem to be having a similar problem. I have an HTML segment with id = duplicate and the necessary scripts added at the beginning. But I do not get any response for it on Firefox. Firebug does not show any error. I can see the HTML in firebug include the jquery script; But the Script tab is blank.

am I doing anything wrong?

Sindhu