Question: If I had two divs, both with id="myDiv", would `$("#myDiv").fadeOut();` fade both divs out? Or would it fade only the first/second? Or none at all?

How do I change which one it fades out?

**Note:** I know duplicate id's is against standards but I'm using the fancybox modal popup and it duplicates specified content on your page for the content of the popup. If anyone knows a way around this (maybe I'm using fancybox wrong) please let me know.

Answer: 
You can also go the route of using find(). find will return all the elements with that ID, and you can limit the scope to a particular parent if needed try something like `$(document).find('#myDiv').fadeOut();`

or 

```
$('.parentElement').find('#myDiv').fadeOut();

```
I ran into the same problem. Apparently, when you create content on the page from which you wish to open a Fancybox, it creates a mirror div of the original content. In my instance, the controls were wrapped in a div that fancybox creates named, "fancy\_div"

I was able to select the control and get it’s value by using the following format for the selector:

```
$('#fancy_div [id=InputText]').val();

```

your controls may exist elsewhere within the Fancybox. the best thing to do is look at the viewsource, but it's tricky.

To get to the view source, use the following technique:
Place this tag on your form:
Get value
Open your form, click on the tag to open the alert window.  

Make sure your cursor is within the page content (find a control and click).  

Right click out of the control and select "view source".  

A bunch of divs exist, so look for the div that contains your content.

Hope this helps.