Tuesday, 20 August 2013

Determine what was clicked on previous page - JQUERY

Determine what was clicked on previous page - JQUERY

i have two divs in one page (div A and div B) and by default Div A is set
as display block and Div B is set as display none. For a user to land on
this particular page, he has to click on a link in a dialog box. Like
this:
<div id"dialog-box">
<a href="/newpage.html" class="firstlink"> First Link </a>
<a href="/newpage.html" class="secondlink"> Second Link </a>
</div>
<div class="newpage">
<div class="divA" style="display:block">
</div>
<div class="divB" style="display:none">
</div>
</div>
What i want to achieve is something like this:
$(".firstlink").click(function(){
$(".divA").css("display","none");
$(".divB").css("display","block");
});
$(".secondlink").click(function(){
$(".divA").css("display","block");
$(".divB").css("display","none");
});
But the above would of course not work because divA and divB is in a
different page... And i dont want to use cookies for this small task.

No comments:

Post a Comment