I have a simple piece of code that changes a select box into a text field if the user selects yes. I then want to be able to change it back to a drop down if if the user checks the box besides the text field.
The issue however is that when it replaces the element, it doesn't append the checkbox to it.
$(document).on("change", "[name=projectRelated]", function(e) {
    // Define our values
    var prj = this.value;
    // Depending on our choice
    switch(prj){
        case 'Yes':
            $(this)
            .replaceWith($('<input/>',{'type':'text','value':'', 'name':'projectRelatedDesc', 'placeholder':'Enter project details'}))
            .append('<div class="checkbox"><label><input type="checkbox" class="notPrjRelated"> No</label>');
        break;
    }
});
Here is a fiddle: https://jsfiddle.net/0ytut7ec/
What am I missing?
appendtoafter- input elements are known as 'void' and cannot have child elementsafter()orbefore()to append it before or after the element.