That link should call another page. (target = "_blank")
On the second page, there's a jQuery function written. It hides/shows the content accordingly (on click). I want to call this jQuery on the click of the link on first page.
How do I achieve this? I just don't want to switch to another page, but to call a specific jQuery function after switching to the second page. There are many such functions are written on second page.
Example:
I have this code:
Code: Select all
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#text1').click(function(){
$('#showtext1').show();
$('#showtext2').hide();
})
$('#text2').click(function(){
$('#showtext2').show();
$('#showtext1').hide();
})
});
</script>
<style type="text/css">
.hidden
{
display:none;
}
</style>
</head>
<body>
<a href="#" id="text1">Text 1</a><br />
<a href="#" id="text2">Text 2</a><br /><br />
<div id="showtext1" class="hidden">
This is text 1. How are you today?
</div>
<div id="showtext2" class="hidden">
This is text 2. I hope you are doing good.
</div>
</body>
</html>
On click of "text1", it shows different text and on click of "text2", it shows a different text.
This is easily achievable, when you are on the same page.
I want to call what is there in "text1" id, from a different page. Similarly, I want to call what's there in "text2" id, from a different page. So, the content changes dynamically. How do I do that?