Refresh html page on changing tabs - javascript

I have problem in shifting from one tab to another in HTML. I have two tabs, #tab1 and #tab2. I have one form in each of the tabs. when I enter details in #tab1, come to #tab2 and again go back to #tab1, the data I entered is not getting refreshed. The old values are retained back. I want a refreshed form.
I tried reloading the page itself by giving -
window.reload(true);
Whwn I did this, the page is displaying and disappearing within a fraction of second.
And also, tried refreshing the form alone by giving -
$('#formID').reset();
Then, the tab itself is not working. I am not getting any exceptions here. I am using jquery for shifting tabs.
Can any one please help me out in tracing out this problem?

Consider this:
$("tabIdHere").click(function(){
$('#formID')[0].reset();
});

Try this one ..
$("tabIdHere").click(function() {
$(this).closest('form').find("input[type=text], input[type=password],textarea").val("");
});
Clear form fields with jQuery check here too

Related

How to remain in the same page on hover table

I've got an hover table with several pages, each row has some action that one can perform with an item.
Whenever one of those actions is performed the page refreshes and the website comes back to page 1 of the table. Is there a way to remain in the same page where I last executed an action on a row?
Thanks in advance.
I was already able to solve this problem, I was not being very precise in my google search and once I changed that I was able to find a pretty simple solution:
$(document).ready(function(){
$(#tableid).DataTable({
stateSave:true
});
});

Multiple Forms on One Page, How to Handle Back Button Behavior?

So I have 3 forms all on one page, and I have buttons on all those forms to go show or hide previous/next forms. However the back button just takes you to the previous page entirely. Is there a way to have the back button to check if there is a previously completed form and go to that form?
Sorry for the open ended question but I'm at a loss.
Using a database to save your previous walk, will be better trying to,manipulate hiding button using styles and JavaScript will get you in cache mess someday ,,
Please paste your code here for we can see wat u have done,,

Angular page demo

I have an angular page that I want to use a plugin like intro.js to demo the different features of the page. However, the issue is that not the entire page is displayed on load. The user is presented with an input box at first that they have to fill out with an id and hit submit. Once they hit submit, the page makes an $http post call and then displays the rest of the page with the data and the other features.
So in this situation, what is the best way to demo this page when only a part of it is display at the beginning? I had 2 ideas
Use a static image of the full page and do a demo on the image
Have a demo button that presents the first part of the page and then when the user submits the id, provide a separate button that demos the rest of the page features
Are those the only 2 ways to do it? Is there any other way?
there are 2 ways
once initial demo is complete, add a hint button (it is feature in intro.js) and restart demo once user click hint
use programmatic way to add steps. first display 2 steps, let user submit the form and on load of controller. restart introjs again

JS: How to repeatedly reload page, read element values, then click button

Over the last few days, I've been working on a script that interacts with a particular site. A page on the site has a table of values that is randomized every reload.
I've learned that I can load the page with JQuery's $.get( ) method and then use regex to read the values of the elements, but I can't figure out how to press a button on the page.
I'm not sure how I could select an element then call the normal .click( ) method on it, or if that would even work at all.
Basically, what I want to accomplish is:
Get a new (reloaded) version of the page.
Read values from an element on the page.
Click a button on the page.
Keep repeating previous 3 steps.
How can I make this happen (with or without JQuery)?
EDIT: So it seems this is difficult/impossible to do from another page, but it works if I'm on the page. Knowing that, is there a way that I can repeating reload the page without disrupting the javascript running on it?
If the buttonpush don't trigger an get/post event, u cant do this. If the button does, you have to simulate it by sending the next get or post with the button parameters. This will get you the expected datas, so no need to refresh.

How to go back to previous page in asp.net while retaining the previous page data

I am having problem while using onclick="javascript:history.back();" with Aspnet. In the first page i filled some data and click search button it show some results, i click on particular result for its details which navigate to the 2nd page but when i click on custom back button it refresh the page and all data set to initial values,when i use onclick="javascript:history.back();" I get nothing but the page displays "webpage has expired."
Thanks in advance!
This is because you are using HTTP POST for your search page.
If you use HTTP GET (putting your parameters in the querystring) - then the browser won't display this message.
This has nothing specifically to do with ASP.NET. It's a (sensible) browser behaviour to prevent you from repeating an action that may have undesirable impacts (for instance, sending two copies of an order)

Categories