Question: I'm having trouble creating a jQuery Accordion using javascript. It creates the Accodion labels just fine, and shows the text of the first element too. It does not show the second elements text, and when you click on it, you lose the first oned text forever too.

```
$("#tab-dock").append('<div id="daccordion">')

$("#daccordion").append('<div id="dinfo"><h3><a href="#">Info</a></h3>')
$("#dinfo").append('<div>Some info about this location.</div>')
$("#daccordion").append('</div>')

$("#daccordion").append('<div id="dmarket"><h3><a href="#">Market</a></h3>')
$("#dmarket").append('<div>Market info would go here!</div>')
$("#daccordion").append('</div>')

$("#tab-dock").append('</div>')

$("#daccordion").accordion({ header: "h3",navigation: true });

```

I have another Accodion which was created normally and it works fine. I just can't get them to match up though. Any ideas? Thanks!

Edit: Thanks for all of the suggestions, learned quite a bit just from them. The problem turned out to be due to size, I had to call the Accordion's resize to get it working.

Answer: 
for library: phonenumbers ([pypi](http://pypi.python.org/pypi/phonenumbers), [source](https://github.com/daviddrysdale/python-phonenumbers))

> 
> Python version of Google's common library for parsing, formatting, storing and validating international phone numbers.
> 
> 
> 

The readme is insufficient, but I found the code well documented.
More verbose, one dependency, but guarantees consistent output for most inputs and was fun to write:

```py
import re

def format_tel(tel):
    tel = tel.removeprefix("+")
    tel = tel.removeprefix("1")     # remove leading +1 or 1
    tel = re.sub("[ ()-]", '', tel) # remove space, (), -

    assert(len(tel) == 10)
    tel = f"{tel[:3]}-{tel[3:6]}-{tel[6:]}"

    return tel

```

Output:

```py
>>> format_tel("1-800-628-8737")
'800-628-8737'
>>> format_tel("800-628-8737")
'800-628-8737'
>>> format_tel("18006288737")
'800-628-8737'
>>> format_tel("1800-628-8737")
'800-628-8737'
>>> format_tel("(800) 628-8737")
'800-628-8737'
>>> format_tel("(800) 6288737")
'800-628-8737'
>>> format_tel("(800)6288737")
'800-628-8737'
>>> format_tel("8006288737")
'800-628-8737'

```

Without magic numbers; ...if you're not into the whole brevity thing:

```py
def format_tel(tel):
    AREA_BOUNDARY = 3           # 800.6288737
    SUBSCRIBER_SPLIT = 6        # 800628.8737

    tel = tel.removeprefix("+")
    tel = tel.removeprefix("1")     # remove leading +1, or 1
    tel = re.sub("[ ()-]", '', tel) # remove space, (), -

    assert(len(tel) == 10)
    tel = (f"{tel[:AREA_BOUNDARY]}-"
           f"{tel[AREA_BOUNDARY:SUBSCRIBER_SPLIT]}-{tel[SUBSCRIBER_SPLIT:]}")

    return tel

```