locked
Check null value in html editor RRS feed

  • Question

  • User-749869896 posted

    how to check null  value in html  editor using jquery 

    this is my html editor 

    <HTMLEditor:Editor ID="txtQEditor" runat="server" Height="300px" Width="500px" Style="padding: 0;" AutoFocus="true"
    NoUnicode="false" />

    this is the code 

    if (document.getElementById("<%=txtQEditor.ClientID %>").value.trim() == "") {
    document.getElementById("<%=dvMessage.ClientID %>").innerHTML = "Please enter Email Body .";
    document.getElementById("<%=txtQEditor.ClientID %>").focus();
    return false;
    }

    but the code is not working how to solve it 

    Thursday, August 4, 2016 10:24 AM

Answers

  • User429228380 posted

    if (document.getElementById("<%=txtQEditor.ClientID %>").value.trim() == "" || document.getElementById("<%=txtQEditor.ClientID %>").value.trim() == null) {
    document.getElementById("<%=dvMessage.ClientID %>").innerHTML = "Please enter Email Body .";
    document.getElementById("<%=txtQEditor.ClientID %>").focus();
    return false;
    }

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, August 4, 2016 10:56 AM

All replies

  • User429228380 posted

    if (document.getElementById("<%=txtQEditor.ClientID %>").value.trim() == "" || document.getElementById("<%=txtQEditor.ClientID %>").value.trim() == null) {
    document.getElementById("<%=dvMessage.ClientID %>").innerHTML = "Please enter Email Body .";
    document.getElementById("<%=txtQEditor.ClientID %>").focus();
    return false;
    }

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, August 4, 2016 10:56 AM
  • User61956409 posted

    Hi manoj150,

    Firstly, could you share us more information (or link) about HTMLEditor control you are using?

    document.getElementById("<%=txtQEditor.ClientID %>").value.trim()

    Secondly, you could check and share us the html source code that you see in F12 developer tools in your browser. And please debug the JavaScript code to make sure if you could find the editor using document.getElementById("<%=txtQEditor.ClientID %>") and add watches to document.getElementById("<%=txtQEditor.ClientID %>") to check the properties.

    Best Regards,

    Fei Han

    Friday, August 5, 2016 7:33 AM