0

i am trying to apply a function to an html id element. I am at the first step And it says

Uncaught TypeError: jQuery(...).myfunction is not a function

https://jsfiddle.net/8cxb3nkt/

Here is the html code:

<img src=myimage.jpg id=image___1>

Here is the javascript:

    function myfunction(){
        console.log('oooooooook');
            }
            
            jQuery('#image___1').myfunction();

Thanks all very much

friend
  • 1
  • Try take a look at this: https://stackoverflow.com/questions/12093192/how-to-create-a-jquery-function-a-new-jquery-method-or-plugin – Carsten Løvbo Andersen Feb 02 '22 at 09:12
  • Start here: https://learn.jquery.com/plugins/basic-plugin-creation/ – freedomn-m Feb 02 '22 at 09:13
  • Hi, i would like to add an action to an image. For this example it could be change the image source if i hover the image (It must be the real basic of javascript, but i dont where to begin with) Thanks – friend Feb 02 '22 at 10:56

0 Answers0