jquery: Call function by name on select change

后端 未结 6 2208
感动是毒
感动是毒 2021-02-20 01:12

I\'m trying to call a function by name .onchange of a select but nothing happens. When the function is describled after the attribute, it works.

THI

6条回答
  •  萌比男神i
    2021-02-20 01:43

    I dont think your reference exists yet to the function here is two ways you could do it. I put the namespaced version as a suggestion because it might help clean up your code in general.

    HTML:

    
    

    SCRIPT:

    // Namespaced and using Proxy

    
    

    // Just declared

    
    

    If your method is in another file make sure you include that file before the one with the event binding. Are you getting any console errors?

提交回复
热议问题