Get Initial Form Value With Javascript January 18, 2024 Post a Comment I have a php generated form like this Product Name Solution 1: Easiest way is to just save it on document load (unless it's being populated by AJAX or some other post-load event; then you'd have to store the initial state there).<script> $(function(){ var $form = $('form'), formOriginalValue; // store initial state on page load formOriginalValue = $form.serializeArray(); // catch the submit handler and compare $form.submit(function(e){ // given 'element1' is a text box://// original value: formOriginalValue['element1']// new value: $('[name="element1"]', this).val(); }); }); </script>CopySolution 2: Another solution may be to use data-* attributes, jQuery has a built-in data() function in order to manage these data. Baca JugaJquery Fadein() And Fadeout() Without DelayJquery Functions, One To Display Dropdown On Click And Another To Get Selected Item From DropdownHow To Make A Link Open In New Tab As Well As Redirect In Current Share You may like these postsHow To Get All Elements Inside "div" That Starts With A Known TextHiding The Source Css CodeSame Tab Content Is Being Displaying TwiceChoose Text Color For Outputted Html Rendered Tabular Data Through Xml With Xsl As Reference Post a Comment for "Get Initial Form Value With Javascript"
Post a Comment for "Get Initial Form Value With Javascript"