jquery - Swapping two text box values -


मेरे पास दो पाठ बॉक्स मान हैं: -

  var pickup = $ ('# txt -पिक अप'); Var गंतव्य = $ ('# txt-destination');   

और मैं दो मानों को स्वैप करना चाहता हूं: -

  pickup.val (destination.val ()); destination.val (pickup.val ());   

हालांकि, उपरोक्त दोनों मूल्यों को समान मान के रूप में हमेशा सेट किया जाएगा। (गंतव्य मान के समान)

क्या इन दोनों को एक ही समय में बदलने का एक तरीका है?

मैंने आपके लिए एक जेएसएफडियल बनाया:

  & lt; इनपुट आईडी = "txt-pickup" type = "text" / & gt; & Lt; इनपुट आईडी = "txt-destination" type = "text" / & gt; & Lt; इनपुट आईडी = "परिवर्तन" प्रकार = "बटन" मान = "स्वैप" / & gt; $ (Document) .ready (function () {$ ("# change")। पर ('click', function () {var pickup = $ ('# txt-pickup')। Val (); $ ('# ($ ('# Txt-destination')। Val ()); $ ('# txt-destination')। Val (पिकअप);});});   



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 -