Question: I have a script that loads a set of form controls based off of the selection made in a drop-down list. I load the elements from a php file in to a `div` using the following code: 

```
<script>
$(function() {
  $('#prompt_type').change(function() {
        switch ($( this ).find(":selected").text()) {           
            case 'Select': 
                $('#prompt_elements').load('index.php?path=promptelm&and_id=' + <?php echo $and->and_id; ?> + ' #type_select');
                break;                              
            case 'Radio':
                $('#prompt_elements').load('index.php?path=promptelm&and_id=' + <?php echo $and->and_id; ?> + ' #type_radio');          
                break;
            case 'Checkbox':

```

This part works great. My issue however is I am saving this information to a database and when I revisit the form even though my drop-down contains the correct value the elements are not loading unless I reselect the option to spark the `.change` event again. Is there a way to call my switch right after the drop-down is loaded?

Answer: 
If you can accept the restriction that you have to pass the name of the directory to be created as the first argument, it should look like this:

```
# mkdir, cd into it
function mkcd () 
{
    mkdir -p "$@"
    cd "$1"
}

```

You need to run `source ~/.bashrc` to see it working (or alternatively start a new shell).
I ran your mkcd function on bash 4.2.45 and linux 3.8.0 and it worked as expected. Logging on in a fresh window or running 

```
source ~/.bashrc 

```

in your existing window should define the function for you. If it does not work you'll get an error message like:

```
mkcd: command not found

```

While hek2mgl's suggestion is not necessary to make it work, it does make it make more sense since you're only going to cd to one directory.