13

I tried adding REQUIRED attribute using .attr("required","true"); but its not making text area compulsory. Do not want to make all textarea, compulsory, hence trying to do it dynamically.

1
  • Can you confirm which browsers you are testing with? Also can you provide the <DOCTYPE> header from your page?
    – Adam
    Jun 29, 2013 at 14:10

1 Answer 1

41
$('#myTextarea').prop('required',true);
4
  • I think its issue with my page, i have tag "<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />" which makes page load in standard mode..but still i get error "Object #<Object> has no method 'prop' "..however, if i put same code in single HTML page..it works fine...thanks though
    – Rohit
    Jun 29, 2013 at 14:17
  • Are you loading jquery at least? If yes, which version?
    – A. Wolff
    Jun 29, 2013 at 14:20
  • :)..yes sir..Jquery 1.7.2 and other Jquery animations and codes are working fine. Just some methods are missing , not sure why, e.g nextUntil , prop...these methods do not work..in IE and Chrome
    – Rohit
    Jun 29, 2013 at 14:23
  • Is it a customized (rebuild) jquery version you are using? Test from a CDN: <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
    – A. Wolff
    Jun 29, 2013 at 15:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.