Quick, Clean & Easy Form Popups (Dialogs) w/ jQuery … Eeeee!

The following itty-bitty snippet loads a page from my site (the new connection type page in this case), grabs the form out of it, injects it into a div which gets injected into the body of the page, then calls dialog on it. :) ComPLETEly unobtrusive, and I don’t have to mess with any of my controllers or views to make it work. :) Ahhh the simplicity.


<a href="/connection_types/new/" class="popup">Add Connection Type</a>

$('a.popup').click(function() {
	$('<div />').appendTo('body').load($(this).attr('href') + ' form').dialog({
		title: $(this).text()
	});
	return false;
});

Read the docs for more info…

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

This entry was posted in AJAX, jQuery. Bookmark the permalink.

5 Responses to Quick, Clean & Easy Form Popups (Dialogs) w/ jQuery … Eeeee!

  1. mark says:

    I bookmarked this site, Thank you for good job!

  2. Tamiflu says:

    I want to say – thank you for this!

  3. Gunnar says:

    Wow.. that saves the rest of the night for me.. thx alot!!!

  4. jen says:

    Great! Glad it helped. :)

  5. Edmundo says:

    Brilliant, I spent a lot of time trying to do this. Your solution is perfect for me. Thanks a lot for sharing.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>