How to migrate a .change function from jQuery to plain Javascript -
i'm not js expert think i'm trying pretty simple (at least in jquery)
i've got 3 select
<select id="faq" class="onchance_fill">...</select> <select id="pages" class="onchance_fill">...</select> <select id="faq" class="onchance_fill">...</select>
and input (it's tinymce 1 in advlink plugin)
<input type="text" onchange="selectbyvalue(this.form,'linklisthref',this.value);" value="" class="mcefocus" name="href" id="href" style="width: 260px;">
i want each time change value in 1 of 3 select, value of option, placed in input.
in jquery, :
$('.ajax_onchance_fill').change(function() { data = $('.ajax_onchance_fill').val(); $('#href').text(data); });
but can't use it. equivalent in plain javascript ?
thanks
i advice keep using jquery speeds kind of thing in pure javascript think want looks this...
<script type="text/javascript"> function load() { var elements = document.getelementsbyclassname('onchance_fill'); for(e in elements){ elements[e].onchange = function(){ document.getelementbyid('href').value = this.value; } } } </script>
Comments
Post a Comment