Robert Granlund
asked on
Clear Hash and ID
On a webpage, I have various divs with specific ID's (#contact, #newsletter, #thank-you,...)
However, in one of the divs there is a form, that on completion sends you to another div (#registration-thank-you)
So now, the url reads www.MYSITE.com#registration-thank-you. How do I strip away the #registration-thank-you after the next click?
However, in one of the divs there is a form, that on completion sends you to another div (#registration-thank-you)
So now, the url reads www.MYSITE.com#registration-thank-you. How do I strip away the #registration-thank-you after the next click?
What are you clicking on - a form button or a link? Also how did the URL get placed on that form/link?
ASKER
@bportlock Div ID via jQuery.ScrollTo
If the url is the action of the form just use javascript to change it on click:
document.getElementById('f ormid').ac tion='www.MYSITE.com';
if the url is from a link same idea:
document.getElementById('l inkid').hr ef='www.MYSITE.com';
Cd&
document.getElementById('f
if the url is from a link same idea:
document.getElementById('l
Cd&
ASKER
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
<form method="post" id="newsjoin">
<h4>Newsletter Signup</h4> :: <input name="email" type="text" id="email" class="newsletter-input" value="<?php if (isset($trimmed['email'])) echo $trimmed['email']; ?>" />
<div class="newsletter-button"> <input name="submit" type="image" id="submit" src="../img/buttons/button -off.png" alt="Join Mailing List" /></div>
<input type="hidden" name="n_submitted" document.getElementById('n ewsjoin'). action='de v.MYSITE.c om'; value="TRUE" />
<input type="hidden" name="css" value="null" />
</form>
in the PHP there is this:
header('Location:#newslett er-thank-y ou');
So, the address looks like this: www.MYSITE.com#newsletter-thank-you
As soon as you navigate to a different ID on that page, I want the #newsletter-thank-you to go away.
<h4>Newsletter Signup</h4> :: <input name="email" type="text" id="email" class="newsletter-input" value="<?php if (isset($trimmed['email']))
<div class="newsletter-button">
<input type="hidden" name="n_submitted" document.getElementById('n
<input type="hidden" name="css" value="null" />
</form>
in the PHP there is this:
header('Location:#newslett
So, the address looks like this: www.MYSITE.com#newsletter-thank-you
As soon as you navigate to a different ID on that page, I want the #newsletter-thank-you to go away.