liamloveslearning Posted June 8, 2010 Share Posted June 8, 2010 Hi all, I have a drop down selector which populates a textarea, When I delete everything in my text area and then try and repopuplate it doesnt work however, Can anybody take a look at my code and have a guess why? Thanks <td valign="top" class="KT_th"><label for="workconsidered_1">What work will you consider?</label></td> <td> <select name="country" id="selbox" onchange="htmlData(this.value,'workconsidered')" /> <option value="">Available Options</option> <option value="Portrait, ">Portrait</option> <option value="Catwalk, ">Catwalk</option> <option value="Glamour, ">Glamour</option> <option value="Implied Topless, ">Implied Topless</option> <option value="Implied Nude, ">Implied Nude</option> <option value="Glamour Topless, ">Glamour Topless</option> <option value="Glamour Nude, ">Glamour Nude</option> <option value="Promotions, ">Promotions</option> <option value="Other">Other</option> </select> <br /> <textarea name="workconsidered" cols="50" rows="5" id="workconsidered" ><?php echo $row_rs_model_biographies_['workconsidered']; ?></textarea> My JS is <script type="text/javascript"> function htmlData(selectValue,targetTextArea) { // alert("select box changed to : '" + selectValue + "'"); var txtNode=document.createTextNode(selectValue); var textArea=document.getElementById(targetTextArea); textArea.appendChild(txtNode); } </script> Quote Link to comment https://forums.phpfreaks.com/topic/204200-deleteing-values-in-text-area-doesnt-allow-new-ones-to-be-inputted/ Share on other sites More sharing options...
brianlange Posted June 8, 2010 Share Posted June 8, 2010 use innerHTML instead of value when setting the text area to blank. var myTextarea = document.getElementById('id'); myTextarea.innerHTML = ''; Quote Link to comment https://forums.phpfreaks.com/topic/204200-deleteing-values-in-text-area-doesnt-allow-new-ones-to-be-inputted/#findComment-1069575 Share on other sites More sharing options...
liamloveslearning Posted June 8, 2010 Author Share Posted June 8, 2010 Thanks for responding brian, Im a complete amateur to javacript, the code you posted is that to go between the script tags? Quote Link to comment https://forums.phpfreaks.com/topic/204200-deleteing-values-in-text-area-doesnt-allow-new-ones-to-be-inputted/#findComment-1069644 Share on other sites More sharing options...
brianlange Posted June 8, 2010 Share Posted June 8, 2010 Yes. Any javascript code needs to go between the script tags. Quote Link to comment https://forums.phpfreaks.com/topic/204200-deleteing-values-in-text-area-doesnt-allow-new-ones-to-be-inputted/#findComment-1069684 Share on other sites More sharing options...
Psycho Posted June 8, 2010 Share Posted June 8, 2010 Just an observation. But, is there some reason you feel you need a complex function such as this for the user to select multiple values instead of just giving the user a list of multiple checkboxes? Seems a much more user-friendly, intuitive solution to me. Quote Link to comment https://forums.phpfreaks.com/topic/204200-deleteing-values-in-text-area-doesnt-allow-new-ones-to-be-inputted/#findComment-1069710 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.