Skip to content

Instantly share code, notes, and snippets.

@seathief
Created March 23, 2020 07:41
Show Gist options
  • Save seathief/147efec9c254ebbc9074e6e1c3ad1cbb to your computer and use it in GitHub Desktop.
Save seathief/147efec9c254ebbc9074e6e1c3ad1cbb to your computer and use it in GitHub Desktop.
html input value sync
# html
<input type="text" class="form-control" id="appName1"
data-sync="input" data-target="#appName2">
# javascript
$("[data-sync='input']").blur(function(){
$($(this).data('target')).val($(this).val());
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment