jQuery selector regular expressions

These can be helpful. If you’re finding by Contains then it’ll be like this $(“input[id*=’DiscountType’]”).each(function (i, el) { //It’ll be an array of elements }); If you’re finding by Starts With then it’ll be like this $(“input[id^=’DiscountType’]”).each(function (i, el) { //It’ll be an array of elements }); If you’re finding by Ends With then it’ll … Read more

Selecting and manipulating CSS pseudo-elements such as ::before and ::after using javascript (or jQuery)

You could also pass the content to the pseudo element with a data attribute and then use jQuery to manipulate that: In HTML: <span>foo</span> In jQuery: $(‘span’).hover(function(){ $(this).attr(‘data-content’,’bar’); }); In CSS: span:after { content: attr(data-content) ‘ any other text you may want’; } If you want to prevent the ‘other text’ from showing up, you … Read more