javascript - how to hide a form initially, but render the form when the screen is reloaded? -
i have form in screen. want hide it. user can enable later on, enter value, , submit form. submitting form update screen. time form stay visible. how do that?
the below javascript hide form initially.
$(document).ready(function(){ document.getelementbyid( 'form1' ).style.display = 'none'; });
the below script submit form. there anyway ensure form stay visible afterwards? have right 'document.getelementbyid( 'form1' ).style.display = 'yes'' not work.
function submitform1(){ document.getelementbyid("form1").submit(); document.getelementbyid( 'form1' ).style.display = 'yes' }
there 2 easy ways persist state across pages(outside local storage).
the first place information form urls. ex. http://localhost?loaded=true. can use code how can query string values in javascript? retrieve value , adjust visibility of form.
the second , more common store sort of state on server either in session or in persistent storage database. when serve page use whatever server side templating language using adjust visibility of form based on data saved.
i ask consider if should redirecting second page form visible instead of manipulating visibility on same page.
Comments
Post a Comment