Hi
please help me, I have some textarea data which needs to be changed when the user select different option from a <select>
.
can you please give me some javascript easy code to do that
please i don't want jquery things
Hi
please help me, I have some textarea data which needs to be changed when the user select different option from a <select>
.
can you please give me some javascript easy code to do that
please i don't want jquery things
Why don't you want to use jQuery? It's about 10 times easier, not just to use but also to debug and it has alot of community support
You can use the onchange
event. I can't write the code for you because I don't know what your current code looks like (and that's not really what this site is about), but I can give you an example:
var select = document.getElementById("mySelect");
select.onchange = function ()
{
// get a reference to the textarea element
var tArea = document.getElementById("myTextArea");
// Set the text to the value of the currently selected option
tArea.value = this.options[this.selectedIndex].value;
}
Try Following it may help...........
< script type="text/javascript">
functionName(this){
var tArea = document.getElementById("myTextArea");
if(this.value=="1"){
tArea.value="1"
}else if(this.value=="0"){
tArea.value="0"
}
< /script>
< select onchange="functionName(this);">
< option value="1">Available< /option>
< option value="0"> Not Available< /option>
< /select>