trying to set the data value of submit button
I've been having problems trying to set the data value of an elment. I
have the following:
<textarea class='pairing-comment' ></textarea>
<input data-comment="" data-global-id="187"
type="submit" id="pairing-comment-submit">
I'd like to update the the data-comment value when the user changes the
textarea (testing has shown this to be the only reliable way to get this
done):
$('textarea.pairing-comment').on('keyup',function() {
var com = $(this).val();
console.log("here i am in pairing-comment " + com); // works fine
$('#pairing-comment-submit').
data('comment', com); // not writing to the data-comment elment
});
What would be the jquery syntax to write what I want to the data-comment
value?
thx
No comments:
Post a Comment