Tutorial :How can I use jQuery to show and hide DIVs based on checkboxes in a submitted form from a different page?


I need to submit a form on one page, and show and hide DIVs on the receiving page based on what checkboxes were checked. The script also needs to display different messages for no checkboxes being checked, some checkboxes being checked, or all checkboxes being checked. Both pages are static HTML.


The form would need to use the GET action so it passes the values on the querystring. Then from Javascript, you need to look at the QueryString to evaluate what was checked. Details of doing than are explained in this question on SO:

get querystring with jQuery


If you were displaying both pages within a single page by using frames or iframes, then you could traverse the DOM to get to whatever elements you wanted to in order to change what's being rendered (I think). In this case, both pages would need to be on the same server (or some domain anyway) to avoid being blocked for cross-site scripting.

Another option would be to embed both "pages" in the same HTML document, have one in a hidden div, which you then show when the user clicks submit.

Hope this helps.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »