jquery mobile - Is onchnge() function works in jquerymobile 1.4.2 -


I am using jquerymobile 1.4.2. This code that I'm using in my page

   & Lt; Script src = "http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.js" & gt; & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Script & gt; Function myFunction () {document.getElementById ("myText"). Disabled = true; } & Lt; / Script & gt; & Lt; P & gt; Click the button to disable the text field. & Lt; / P & gt; & Lt; onchange = "myfunction ()"> gt; & Lt; Options & gt; 1 & lt; / Option & gt; & Lt; Options & gt; 2 & lt; / Options & gt; & Lt; / Select & gt; First name: & lt; Input type = "text" id = "myText" & gt; & Lt; / Body & gt; & Lt; / Html & gt;   

The above program works fine but if I change it to this code

  & lt; Script & gt; Function myFunction () {document.getElementById ("myText"). Disabled = false; } & Lt; / Script & gt; & Lt; P & gt; Click the button to disable the text field. & Lt; / P & gt; & Lt; onchange = "myfunction ()"> gt; & Lt; Options & gt; 1 & lt; / Option & gt; & Lt; Options & gt; 2 & lt; / Options & gt; & Lt; / Select & gt; First name: & lt; input type = "text" id = "myText" disabled = "disabled" & gt;   

is not working then please help me how to enable the text field to use the onchange () function

Enhances jQM input and creates a text input widget which, in your own enabled / disabled methods ()

To enable:

  function myFunction () {$ ("# myText"). Text input ("enabled"); }   

In addition, you should use unreliable Javascript and Jqum page functions. Remove onclick from markup like:

  & lt; Id = "theselect" & gt; & Lt; Options & gt; 1 & lt; / Options & gt; & Lt; Options & gt; 2 & lt; / Options & gt; & Lt; / Select & gt; First name: & lt; Add handler to the pagecreate jQM event:  
  function myFunction (selVal): input type = "text" id = "myText" disabled = "disabled" />   

) {If (selVal == '2') {$ ("# myText") TextInput (. "Enabled"); } And {$ ("# myText"). Text input ("disabled"); }} $ (Document) .on ("pagecreate", "# page1", function () {$ ("# theselect"). ("Change", function () {var v = $ (this) .val ( ); My Function (V);});});

Here's a

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -