I'm trying to add 'checked' attribute to HTML string, which contains multiple HTML tags.
let someBtn = `<div class='btn'><input type='checkbox' id='${item.Id}'
value='Some value' class='active-btn'> <label class='btn'
for='${item.id}'></label></div>`;```
Doing it this way:
var something = $($.parseHTML(someBtn)).find('input[type=checkbox]').attr('checked', 1).prop('outerHTML');
returns only the tag, not the whole updated HTML string.
Also that input tag gets checked="checked" attribute instead of just checked. Why is that? I cannot use attr('checked', true) - there's no method with this kind of parameters.
Could somebody please help me out with this problem - to return the whole HTML string with proper checked attribute?