I am new to Jquery, please help me. At present I am inserting asterisk class in the header , but I want to check one more condition, before inserting , Please help me how do I check that. At present its keep on inserting every Edit button click in the Grid. But I want to insert only once , If it is already present on the header then I should not insert again mycode, I am using Kendo Edit Grid-
edit: function (e) {
var grid = this; e.container.find('td').each(function (_, x)
{
var cell = $(x);
var input = cell.find('input[name]');
if (input.attr('name')) {
var headerCell = grid.thead.find('th:eq(' + cell.index() + ')');
headerCell.append($(''));
}
});
}
CSS class name -
.asterisk:after {
content: " *";
color: #b1001d;
}
I can give you the vanilla javascript code. because jquery isn't usefull anymore.
if(typeof(element)!== 'undefined'){
//your code
//eg:
const newElement = '<h1>hello</h1>'
element.append(newElement)
}
我可以使用以下代码执行此操作:
$('.asterisk').remove();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.