Hello everyone,
I'm trying to select same "id" for more than one input. My code works with 1 input, but when I add 2 textareas or more my code stops working...
Here's my code:
Javascript
*<script>
function validateComment() {
var value = $("[id=commentbox]").val();
var word = value.toLowerCase();
// make sure this word is lowercase
if( document.myForma.commentbox.value == "" )
{ document.getElementById('comment-error').innerHTML = '<style> #error-comment-info_empty {display:block !important; }</style>'; return false; }
if (word.indexOf("bad-word") != -1) {
document.getElementById('comment-error').innerHTML = '<style> #error-comment-info {display:block !important; }</style>'; return false;}
if (word.indexOf("bad-word") != -1) {
document.getElementById('comment-error').innerHTML = '<style> #error-comment-info {display:block !important; }</style>'; return false;}
if (word.indexOf("bad-word") != -1) {
document.getElementById('comment-error').innerHTML = '<style> #error-comment-info {display:block !important; }</style>'; return false;}
if (word.indexOf("bad-word") != -1) {
document.getElementById('comment-error').innerHTML = '<style> #error-comment-info {display:block !important; }</style>'; return false;}
else {
return false;
}
}
</script>*
<textarea id="commentbox" class="auto" rows="2" data-min-rows="2" name="commentbox" placeholder="Write your staff here ..."></textarea>
<textarea id="commentbox" class="auto" rows="2" data-min-rows="2" name="commentbox" placeholder="Write your staff here ..."></textarea>
Thanks :)