I am using dropdownlist and one label in my html page. I want to change name of label on selection of my dropdownlist box. How is it possible?
pls povide any help for me .
Check this example.
It will change the attribute 'name' of your label, and its text content (reading its new name attribute value) to see the change in effect.
<script type="text/javascript">
function changeValue(select) {
var value = select.options[select.selectedIndex].value;
var label = document.getElementById('mylabel');
label.setAttribute('name', value);
label.innerHTML = label.getAttribute('name');
}
</script>
<select name="selectcity" onchange="changeValue(this);" >
<option>Mumbai</option>
<option>Delhi</option>
</select>
You selected: <label id="mylabel" name="citylabel"></label>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With