How would I add an attribute to an element if that element does not already have that attribute?
if (' this does not have class=selected') {
$(this).addClass('selected');
}
if(!$(this).attr('name')) {
$(this).attr('name', 'value');
}
that ought to do it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With