Guest User

Untitled

a guest
Jun 17th, 2012
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. How to migrate a .change function from jQuery to plain Javascript
  2. <select id="faq" class="onchance_fill">...</select>
  3. <select id="pages" class="onchance_fill">...</select>
  4. <select id="faq" class="onchance_fill">...</select>
  5.  
  6. <input type="text" onchange="selectByValue(this.form,'linklisthref',this.value);" value="" class="mceFocus" name="href" id="href" style="width: 260px;">
  7.  
  8. $('.ajax_onchance_fill').change(function() {
  9. data = $('.ajax_onchance_fill').val();
  10. $('#href').text(data);
  11. });
  12.  
  13. <script type="text/javascript">
  14. function load() {
  15. var elements = document.getElementsByClassName('onchance_fill');
  16. for(e in elements){
  17. elements[e].onchange = function(){
  18. document.getElementById('href').value = this.value;
  19. }
  20. }
  21. }
  22. </script>
  23.  
  24. document.getElementsByClassName("ajax_onchance_fill").onchange = function() {
  25. getElementById('href').value = this.options[this.selectedIndex].text;
  26. };
  27.  
  28. $('.ajax_onchance_fill').change(function() {
  29. var data = $(this).val();
  30. $('#mytextboxid').val(data);
  31. });
Advertisement
Add Comment
Please, Sign In to add comment