javascript - jquery not tracking form changes -


i working on primefaces application,

initially list of items displayed, clicking on item user can edit item.

in case there 5 tabs, if user clicks on first tab list item, 4th tab content displayed, clicks on second tab list item fifth tab displayed.

the url same these pages

for ex: localhost:8080/myapp/tabs.xhtml

<ui:composition xmlns="http://www.w3.org/1999/xhtml">     <script type="text/javascript">         $(document).ready(function() {             isinputchanged = false;             $("#tabview").on("change", ":input", function() {                 isinputchanged = true;             })         });     </script>     <p:tabview id="tabview" activeindex="#{mybean.tabindex}"         style="min-height:750px;height:auto;border:0;padding:0" dynamic="true" styleclass="hidetabheader" >          <p:tab id="tabcontents1">               <ui:include src="/tabcontents1.xhtml"></ui:include>         </p:tab>                     <p:tab id="tabcontents2">               <ui:include src="/tabcontents2.xhtml"></ui:include>         </p:tab>         <p:tab id="tabcontents3">               <ui:include src="/tabcontents3.xhtml"></ui:include>         </p:tab>         <p:tab id="tabcontents4">               <ui:include src="/tabcontents4.xhtml"></ui:include>         </p:tab>         <p:tab id="tabcontents5">               <ui:include src="/tabcontents5.xhtml"></ui:include>         </p:tab>     </p:tabview> </ui:define> 

while debugging through chrome problem because of same url, input change in fourth , fifth tab not tracked, mean isinputchanged never becomes true. in chrome debugging tool, source showing same.

but, if add parameter url localhost:8080/myapp/tabs.xhtml?itemid = 100, in source can see fifth tab code, , if change input isinputchanged become true script.

how can handle situation, in advance!!!!!!!!!

i think it's because following code works when localhost:8080/myapp/tabs.xhtml loads.

$("#tabview").on("change", ":input", function() {     isinputchanged = true; }); 

are including files after that, browser not able see changes.

like @alive die commented try put script code @ bottom of page , check.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -