I am trying to get HTML code to jquery variable and it is working in following code:
var html_var = $(this).parent().html();
But when I want to modify "html_var" I cannot do it, I mean, the html code contains button tag and I need to change this button's value and id? I tried with "find" but I don't why it didn'y work.
var modified_var = html_var.find('.button').attr('id');
.html()gets the html, not the DOM elements, so you can't find the button by class etc.$(this).parent().find(".button").attr("id", someValue)or use regex/replace to manipulate the html text. Depends on your use case