I have a simple application where users input string values into two fields and the text is incorporated into a sentence.
I am looking to add a button that, when clicked, will switch the values in the fields.
HTML
<body>
<div ng-app="myApp" ng-controller="myCtrl">
Old Value: <input type="text" ng-model="oldValue"><br>
New Value: <input type="text" ng-model="newValue"><br>
Prefix: <input type="text" ng-model="prefix"><br>
<br>
UPDATE {{ prefix }}_options SET option_value = replace(option_value, 'http://{{ oldValue }}', 'http://{{ newValue }}') WHERE option_name = 'home' OR option_name = 'siteurl';<br>
UPDATE {{ prefix }}_posts SET guid = replace(guid, 'http://{{ oldValue }}','http://{{ newValue }}');<br>
UPDATE {{ prefix }}_posts SET post_content = replace(post_content, 'http://{{ oldValue }}', 'http://{{ newValue }}');<br>
UPDATE {{ prefix }}_postmeta SET meta_value = replace(meta_value,'http://{{ oldValue }}','http://{{ newValue }}');<br>
</div>
</body>
JAVASCRIPT (Angular)
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.oldValue= "oldvalue";
$scope.newValue= "newvalue";
$scope.prefix= "wp";
});
Upon clicking a button, 'oldvalue' and 'newvalue' will swap positions.
Any assistance on this matter would be highly appreciated.