1

I have iFrame in my main html file and I'm loading a sub html in that iFrame. Sub HTML has some functions like on click of anchor tag I'm calling a function and that function is loading some page. Now in my main iFrame when I click that anchor tag of sub HTML, I want to override that function, instead of loading I want to embed some file. Right now both main html and sub html on click both are working. When I checked the event listener I saw main html click is first and then sub HTML click function. In that case how can I override it? I have tried e.preventDefault() , e.stopImmediatePropagation();

slewis
  • 11
  • 4
  • 2
    Can you provide some code? – Kaushal Suthar Apr 27 '16 at 13:08
  • Your problem is ALMOST clear... Yet according to [this site standards](http://stackoverflow.com/help/how-to-ask) we need to be able to `reproduce` your problem. As I can see you are new here... Then provide a little code and let us see how many minutes it will take to propose one OR more solutons – Salathiel Genese Apr 27 '16 at 13:12
  • Sub HTML has script.js where my below code is there var $pdf = { click: function () { window.onload('test.pdf') } }; $pdf will load after the pop up Main html overriding function is below $('a').on('click', function(e) { if (url.split('.').pop() === 'pdf') { e.stopImmediatePropagation(); } else if ($(this).parent().hasClass('pdf') || $(this).hasClass('pdf') || $(this).hasClass('pdf-button-isi')){ e.stopImmediatePropagation(); /* EMBED CODE */ } } – slewis Apr 27 '16 at 17:20

0 Answers0