jQuery, forms - display saved changes
I have many inputs in a few divs, every div is being hidden and is being show only after user clicks a link.
When user clicks "Send" button the changes he made go to the back-end BUT the page refreshes and there's no div visible.
See live example:
http://jsfiddle.net/9FXua/4/
Explanation:
Click Link #1. "This is first section." is placed where all my inp开发者_C百科uts are. Click "Send"
NOW it shows the first page again, but I'd love to redirect user to the same page where he made some changes (in this case "This is first section.".
Any ideas?
You could use the anchor attribute to trigger the link — something like this:
HTML
<ul>
<li><a id="link-1" href="#link-1">Link #1</a></li>
<li><a id="link-2" href="#link-2">Link #2</a></li>
<li><a id="link-3" href="#link-3">Link #3</a></li>
<ul>
Javascript
var location = window.location.hash;
if (location) { $('a#'+location).trigger('click'); }
精彩评论