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.

zkanoca
  • 9,664
  • 9
  • 50
  • 94
Rohit
  • 284
  • 1
  • 3
  • 14
  • Can you confirm which browsers you are testing with? Also can you provide the header from your page? – Adam Jun 29 '13 at 14:10

1 Answers1

40
$('#myTextarea').prop('required',true);
A. Wolff
  • 74,033
  • 9
  • 94
  • 155
  • I think its issue with my page, i have tag "" which makes page load in standard mode..but still i get error "Object # has no method 'prop' "..however, if i put same code in single HTML page..it works fine...thanks though – Rohit Jun 29 '13 at 14:17
  • Are you loading jquery at least? If yes, which version? – A. Wolff Jun 29 '13 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 '13 at 14:23
  • Is it a customized (rebuild) jquery version you are using? Test from a CDN: – A. Wolff Jun 29 '13 at 15:22