0

I have a simple enough javascript function which checks if text exceeds limit if certain placeholder is added.:-

    function updateText(){

      var selecnotificationplaceholder = document.getElementById('mainFrom:selecnotificationplaceholder');            
      var notificationTextTxt = document.getElementById('mainFrom:notificationTextTxt');  
      var resultedLength = notificationTextTxt.value.length + selecnotificationplaceholder.value.length;
      if (resultedLength <= 5) {
        alert("To be added");
      }
      else {
        alert("Could not be added");
      }
    }

But I get this parsing error when loading the page on the line

    if (resultedLength <= 5) {
Soham Banerjee
  • 117
  • 1
  • 13
  • This code as shown does not seem to contain any syntax errors whatsoever. Whatever your problem is, this snippet alone does not reproduce it. – CBroe Sep 11 '17 at 11:32
  • When I use other relational operator it is parsed successfully (like ==), but when using < OR > its throwing parsing error. Seems like the xhtml is treating it as an opening tag – Soham Banerjee Sep 11 '17 at 11:41
  • 1
    So you are not even talking about a client-side, actual _JavaScript_ error ...? Then please first of all update your question with all the relevant information! – CBroe Sep 11 '17 at 11:43
  • A mistake in last comment, I was using <= and it was throwing parsing error, now when I use > and reverse the logic, it works fine, ... This is a single page JSF application's screen, running on tomcat – Soham Banerjee Sep 11 '17 at 11:50

0 Answers0