4usolutions 4usolutions - 1 year ago 72
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.

Answer Source

Just pass string selector:

  click: function(e) {
  mouseenter: function(e) {
    alert('mouse enter!');
}, '#tags');
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download