0

I'm having problems to clear class with removeClass of jQuery.

jquery script:

$('#btnPrint').click(function () { $('*').removeClass('validate[required]'); });

Html code:

<textarea class="validate[required, maxSize[1, 4000]] text-input uniform fieldValidationError" name="textBox_123" id="textBox_123"></textarea>

I'm probably going to have to do some regex to solve this problem, but don't know how.

Thanks.

Renato Leite
  • 743
  • 6
  • 26
  • 6
    I've never seen arrays used in class names before. I would just have a class named `required` and use a [custom data attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes#data-*) for other data, e.g. `data-maxSize="1,4000"`. – showdev Oct 17 '13 at 01:25
  • 4
    you can't have spaces in class names, really you're just adding classes such as `validate[required,` and `maxSize[1,` and `4000]]` which I'm pretty sure is not what you're trying to do. – cobbal Oct 17 '13 at 01:42
  • @renato.leite check [this](http://stackoverflow.com/questions/448981/what-characters-are-valid-in-css-class-selectors#449000) SO post for vaild caharacters allowed in class names – gwillie Oct 17 '13 at 02:40
  • Hi, I go read about it, thanks! – Renato Leite Oct 17 '13 at 02:56

1 Answers1

0

I resolved the problem using this:

$('[class*=required]').attr("class", "");

Thanks for all.

Renato Leite
  • 743
  • 6
  • 26