Reputation: 3516
I have a partial which is rendered using identical code between the new and the edit controller actions, containing a form for the associated model and nested resources.
As a troubleshooting step for working out why the jQuery included in this partial was working on the edit form and not the new form, I've removed all existing jQuery and replaced it with this:
$("input").click(function() { alert("test!"); });
This works as expected when loading the edit form, all input fields/buttons/dropdowns display the alert box when clicked. However, when the new form loads, this does not apply.
Any suggestions as to how I can troubleshoot this?
Upvotes: 1
Views: 157
Reputation: 3516
This was all caused by an issue with a plugin I was using to help with displaying some of the content; I passed in the string of the div id as an argument to it, and instead of applying its methods directly to the div in the DOM, it duplicated it all further down the page, meaning the id's were being recreated and in addition, meant the jQuery executed on page load didn't apply to the new objects.
Upvotes: 0
Reputation: 2191
It sounds like you might have a javascript error on the new form which is breaking javascript and stopping it from executing further. Can you use your browser inspector to see if there are any javascript errors on the page?
Upvotes: 1