I have a javascript code working ok, so if the inputbox is blank it tells you, I also need to put a MINIMUM number of chars (for example minimum 10 characters should be inputted)…
PLEASE can somebody help me with this, here is the code:
var title = document.getElementById('title').value;
var flag = 0;
if(title == "")
{
requiredfields = requiredfields + '<li><?php echo JText::_('MUST PROVIDE TITLE');?></li>';
document.getElementById('title').focus();
flag = 1;
}
and here is what I added after this but it doesn’t want to work… I mean it doesn’t give any errors or something.. it just doesn’t react..
if ( title < 10 )
{
requiredfields = requiredfields + '<li><?php echo JText::_('MUST PROVIDE MINIMUM 10 CHARS');?></li>';
document.getElementById('title').focus();
$('title').addClass("invalid");
flag = 1;
}
Can somebody please help me?
Thanks.
You can use
lengthproperty: