I have this code in javascript
which passes values to inputs
. When I use this code it inserts the data in input
normally but when I make a click
after having passed the values the input
automatically erases the value that was entered. Your I replace this.getAttribute('data-email')
with string
for example: user_email = "abc"
value is passed to my input
but is not deleted when I click
. how do I pass the value so it is not deleted?
$('.userEdit').click(function() {
var user_email = this.getAttribute('data-email');
var user_type = this.getAttribute('data-type');
var user_function = this.getAttribute('data-function');
function myFunc(elem, val) {
return document.getElementById(elem).value = val;
}
myFunc("edit_form_user_email", user_email);
});