javascript - Swap Images With jQuery hover -


I have an IMG tag with the following details: id = "hover1" src = "HelloPG"

  $ ('# button1'). Click (function () {$ ('# hover1'). Attr ('src', 'hello_hover.png');}); $ ('# button2'). Click (function () {$ ('# hover1'). Attr ('src', 'hello.png');});   

However, when I try to swap the images with the following code, then nothing like this happens.

  $ ('# hover1'). Hover (function) {$ (This) .attr ('src', 'hello_out.png')}}, function () {$ (this) .attr ('src', 'hello.png');});   

The code looks good to me, is it failing? Please help me I am using jQuery 2.1.0, Mozilla 26.0, Windows 7. Thank you.

  $ (function () {$ ('an img'). Hover (function ) {$ (This) .attr ('src', $ (this) .attr ('src'). Replace (/ .jpg /, 'yourImageName.jpg'));});   

see it .. thanks

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -