Home  >  Article  >  Web Front-end  >  Code for changing color and background implemented by jquery change(fontsize,background) supplement 2_jquery

Code for changing color and background implemented by jquery change(fontsize,background) supplement 2_jquery

WBOY
WBOYOriginal
2016-05-16 18:27:311390browse

change(fn)
Bind a handler function to the change event of each matching element. The
change event is triggered when an element loses focus, and also when its value changes after gaining focus.


[Ctrl A Select all Note:
If you need to introduce external Js, you need to refresh to execute
]Jquery change( fontsize,background) code to change color and background<script> $(function(){ $('#c-obj select').change(function(){ alert($(this).attr('id') + ': ' + $(this).val()); $('p').css($(this).attr('id'), $(this).val()); //select的ID和要设置的CSS属性值必须保持一致 }); }); </script>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn