Home > Web Front-end > HTML Tutorial > How to change the style of another control in mouseenter?_html/css_WEB-ITnose

How to change the style of another control in mouseenter?_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:07:21
Original
1310 people have browsed it

If there are two controls, ctl0 and ctl1, and you hear the mouse passing by the ctl0 control, how to change the foreground and background colors of the ctl1 control?
$(document).ready(function(){
$( "ctl0").mouseenter(function(){
                                                   

$('ct1').css('background-color:red;color:white') Try

Thank you, but ctl1 is the class name of the control, not the control ID, and it is of the same type There is more than one name. I want to change the style of only one of them, such as .ctls1 .ctl1, but it doesn’t work.
$(this).css('background-color:red;color:white' )

Try this

$(this).css('background-color:red;color:white')

Is this just changing the control that triggers the event?

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template