locked
How to Insert string properly RRS feed

  • Question

  • User134074001 posted

    Hello friends,

    I have this query about how to properly append or insert string .Every time the function executes, it appends a new <p></p>.So I can understand, but how can refresh the <span></span> and if someone tried to execute this function, it will only show 1 <p></p> and not keep on appending the <p></p>

    First see this link to error screenshot:- https://uploadpie.com/kCdnBX

    Here's the code

     function confm()
            {
                debugger;
                var ps=document.getElementById("pass").value;
                var cps=document.getElementById("cpass").value;
    
                if(ps==cps)
                {
                    $("#cspan").attr("style", "color:green");
                    //$('#cpsan').append('style="color:green"');
                    @*@ViewBag.confirm="Both Passwords Match!";*@
                    $('#cspan').append("<p>Both Passwords Match!</p>");
    
                }
                else
                {
                    $("#cspan").attr("style", "color:red");
                    //$('#cpsan').append('style="color:green"');
                    @*@ViewBag.confirm="Passwords Don't Match!";*@
                    $('#cspan').prepend("<p>Passwords Don't Match!</p>");
                    return false;
                }
            }


    Best Regards,
    Aniruddha

    Saturday, August 11, 2018 6:56 PM

All replies