Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript How to set values to custom attributes in Jquery Reply To: How to set values to custom attributes in Jquery

#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