4usolutions 4usolutions - 8 months ago 50
jQuery Question

How .on works for $(document)

I'm a newbie for that, so i'm sorry for asking confused and simple thinks :-)

My JS Code wont work for a moadal with a form that is loading from a ajax-call and php side.

I think i have to call the function in way like this

$(document).on('click', '#tags', function ()

I dont now how i should change the original code into this - maybe someone can help me and explain it for me?

$('#tags').on({ click: function(e) {
mouseenter: function(e) {
alert('mouse enter!');

If i only use the "$('#tags')" it wont work for me...

Hope i could explain what i want to do.


Just pass string selector:

  click: function(e) {
  mouseenter: function(e) {
    alert('mouse enter!');
}, '#tags');