<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Dana Woodman &#187; JavaScript</title>
	<atom:link href="http://www.danawoodman.com/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.danawoodman.com</link>
	<description>The online home of Dana Woodman.</description>
	<lastBuildDate>Tue, 31 Aug 2010 22:05:09 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Creating a simple &#8220;Delete&#8221; confirmation dialog with jQuery</title>
		<link>http://www.danawoodman.com/2009/11/creating-a-simple-delete-confirmation-dialog-with-jquery/</link>
		<comments>http://www.danawoodman.com/2009/11/creating-a-simple-delete-confirmation-dialog-with-jquery/#comments</comments>
		<pubDate>Mon, 09 Nov 2009 23:59:08 +0000</pubDate>
		<dc:creator>Dana Woodman</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.danawoodman.com/?p=31</guid>
		<description><![CDATA[I often find the need to add a confirmation to a delete link in my applications and in this short tutorial I will show you how to do it using just a few lines of jQuery.



I often find the need to add a confirmation to a delete link in my applications. Below is a very [...]]]></description>
			<content:encoded><![CDATA[<p>I often find the need to add a confirmation to a delete link in my applications and in this short tutorial I will show you how to do it using just a few lines of jQuery.</p>

<p><span id="more-31"></span></p>

<p>I often find the need to add a confirmation to a delete link in my applications. Below is a very simple way to achieve this with jQuery.</p>

<p>First, you&#8217;ll need a link that you will be clicking where you want the confirmation box to pop-up.
<pre>&lt;p&gt;&lt;a href="/some/path/to/delete" class="delete"&gt;Delete&lt;/a&gt;&lt;/p&gt;</pre>
Next, you will need to add in the jQuery. If you haven&#8217;t imported jQuery in you page yet, do so above this code.
<pre>&lt;script type="text/javascript"&gt;
    $(function() {
        $('.delete').click(function() {
            return confirm("Delete this item?");
        });
    });
&lt;/script&gt;</pre>
Now all this does it pops up a &#8220;confirm&#8221; dialog box and if the user clicks &#8220;OK&#8221; the link will be followed, deleting the item. If they click &#8220;Cancel&#8221; nothing will happen.</p>

<p>Well, that&#8217;s it. Nothing special, but comes in handy once and a while.</p>

<p><em><strong>Note</strong>: Thanks to Brian for his suggestion!</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.danawoodman.com/2009/11/creating-a-simple-delete-confirmation-dialog-with-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
