سؤال

I have an input and I set its value with jQuery

$('#' + inputId).val(function() {
    alert("SETTING VAL TO "+ myValue);
    return myValue;
});

Low and behold this sets the value, as verified in the console. However the displayed value in the input text area does not change. How do I do that?

هل كانت مفيدة؟

المحلول

It turned out I had two elements with the same id. Weird thing is the chrome element inspector showed the correct value attribute for the input, but the text did not change, presumably for this reason.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top