jqModal disables form elements - not sure how to fix...
I'm using jqModal and jQuery for some modals in a new app I'm working on, all is going well, except when I have a form embedded in the modal. For some reason, when I check a checkbox, nothing happens. If I add an alert
Location: Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
Posts: 7,686
Thanks: 42
Thanked 637 Times in 625 Posts
I happen to be using the jqModal plugin right now too. I added a checkbox to my code and I was able to check and uncheck it with no weird behavior. The value of the checkbox comes through fine as well.
So... I'm stumped! Something in your code must be detecting when the checkbox is checked and unchecking it... I guess?
If you click on the big RSS icon, the modal should open. Click on the "Fonts" tab in the modal, then try checking any checkbox.
None of them stay checked for me (FF3.0 Linux). The first checkbox (for Heading Bold) I added an alert, so you can see that it does get checked, but once you click "Ok" on the alert, it unchecks. There's no code (that I can see) that's unchecking things.
I've stripped pretty much everything out (js / css wise) except what's needed for the modals.
Location: Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
Posts: 7,686
Thanks: 42
Thanked 637 Times in 625 Posts
Hmmm...wow. I've done my jqModal stuff differently. I use the trigger attribute to identify the link that opens the jqModal, then use a jQuery selector to assign the div that will get opened. Pretty much just like described here:
I copied your test page and made some changes to open the modal div using this technique and the checkboxes started behaving. I added this to your page-ready function:
Location: Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
Posts: 7,686
Thanks: 42
Thanked 637 Times in 625 Posts
Anywhere, but I usually just put one in my page.js script and add all of my selectors under that one umbrella. It's the way to say "the page is loaded, now do this stuff", but is better than Javascript's "onload" because it will start before images have been fully downloaded-- all it waits for is the DOM.
BTW I use the shorthand version $(function() {} but it doesn't really matter.