Learning jQuery on events and jQueryon events

Source: Internet
Author: User

Learning jQuery on events and jQueryon events

Developing asp.net mvc programs is inseparable from jQuery client programs. Today, Insus. NET learns a jQuery on Event driver.

First, put an image button in the webpage view. You can use mouse to over, out, or click the image, and change the image src according to different events.

Create an Action in the controller:

 

Create View:

 

After the view is created, Mark steps 1 to 3 on the buttons respectively. Mark 1 is to pull an input, type is image, Mark 2 references the jQuery class library, and mark 3 is to implement all the Event code.

In the script, define the src path of the three images:



Load the original image on the webpage:



When the user moves the mouse to the image over, it will change to the original image ..On('Mouseover', function (){...}



When the user moves the mouse away from the image, the image is switched to the original image ..On('Mouseout', function (){...}

 

If you move the mouse to the image and press the mouse button to click it, we can change the image src path again.

 


Let's take a look at the final effect:

 

JQuery code can be implemented through link. Let's take a look:

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.