Home >Web Front-end >JS Tutorial >Jquery change(fontsize,background) code to change color and background_jquery

Jquery change(fontsize,background) code to change color and background_jquery

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

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 ] <script> $(function(){ $('#fontsize').change(function(){ var size = $('#fontsize').val(); $('p').css('font-size', size); }); $('#backgoundcolor').change(function(){ var bgc = $('#backgoundcolor').val(); $('p').css('background', bgc); }); $('#fontcolor').change(function(){ var fontcolor = $('#fontcolor').val(); $('p').css('color', fontcolor); }); }); </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