<div class="panel my_snippets">
<div class="panel-body">
<strong class="my_sitename">Title</strong><br/>
<span class="text-primary"><a
href="https://toster.ru/question/new"
target="_blank"
class="my_url">https://toster.ru/question/new</a></span><br/><span
class="my_snippet">TEXT</span>
</div>
<div class="panel-footer form-inline">
<input type="text" class="form-control input-sm my_type"
placeholder="Тип сайта"
value=""/>
<input type="text" class="form-control input-sm my_action"
placeholder="Наши действия" value=""/>
поз:
<div class="input-group spinner ">
<input type="number"
class="form-control input-sm my_poz" value="">
</div>
нег:
<div class="input-group spinner ">
<input type="number"
class="form-control input-sm my_neg" value="">
</div>
</div>
</div>
$(".my_snippets ").each(function (i, e) {
$(e).find('input').change(function () {
var zn = $(this).val();
var cl = $(this).attr('class');
var url = $(this).parent().prev().find('.my_url').text();
console.log(cl);
changeInput(zn, cl, url);
})
})
function changeInput(z, c, u) {
$(".my_snippets ").each(function (i, e) {
// var url = $(e).find('.my_url');
// if(url.text() == u) {
// return url.parent().next().find(c).text() = z;
// }
//
var url = $(e).find('.my_url').text();
//console.log(url);
if (url == u) {
if($(this).parent().next().hasClass(c)){
console.log($(this));
}
}
})
}
.text()
а .val()
$(".my_snippets input").change(function () {
var zn = $(this).val();
var cl = $(this).attr('class');
var url = $(this).closest('..my_snippets').find('.my_url').val();
changeInput(zn, cl, url);
});