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: