search

Home  >  Q&A  >  body text

javascript - Every time the child element iframe is refreshed, the parent iframe is superimposed and loaded.

Because the parent layer needs to use js to obtain the elements in the child iframe, so

$('.base')[0].onload = function(){
    $("#id").click(alert(1));
}

Now I find that every time the sub-layer is refreshed, clicking an element on the parent layer will superimpose it once
In other words, the first click will bounce once 1
Then refresh the sub-layer once, and click once again, it will bounce How to avoid 1
twice?

阿神阿神2738 days ago444

reply all(1)I'll reply

  • 巴扎黑

    巴扎黑2017-05-19 10:10:26

    $("#id").click(alert(1));
    click之前先解绑
    $("#id").unbind('click').click(alert(1));

    reply
    0
  • Cancelreply