Note that your test page is pretty mixed up... The buttons have the same "Close" ID, and work in the opposite way from what they say.
No, you don't need separate files. But JS directly inside HTML is a bad idea unless it's the only way - which it's not in this case.
Code:
I also need to do this for 4-5 more elements/links on the same page.
Do these other elements do the same thing as the ones you've already shown, just with different data?
I suggest that you change the <p> with the buttons to a <div>. Then replace my above code with this... (I couldn't find any definition of the tb_elmnt function so I'm ignoring it.)
Code:
cantThinkOfAGoodName('#hiddenModalContent', 'URL of the zip file');
function cantThinkOfAGoodName(tos, url){
tos = $(tos);
tos.find('input#Close').click(tb_remove);
tos.find('input#Agree').click(function (){
tb_remove();
window.location.href = url;
});
}
Bookmarks