Home › Forums › JavaScript › How to set values to custom attributes in Jquery › Reply To: How to set values to custom attributes in Jquery
August 6, 2013 at 6:46 am
#145824
gowda24
Participant
Hi george,
$('input[type="text"]').attr('data-parentID', 'newvalue');
This works but here you are adding newvalue as string.
How if i am adding a jquery returned value.
var val = $(“.id1”).find(‘td’).val();
$(‘input[type=”text”]’).attr(‘data-parentID’, val);
This statement is not working