jquery - Replace several input values -
i have function small chat system i'm working on. when users types "shout" preceded text (ex: "shout hello!"). want "hello!" output (the rest should ignored). worked fine when had 1 command. have "shout" & "message". tried doing code below doesn't seem work:
function checkvalue() { var value = document.getelementbyid("thisinput").value; // output text without "message" in front if (value == "message") { $('#output').html(value.replace('message', '')); } // output text without "shout" in front else if (value == "shout") { $('#output').html(value.replace('shout', '')); } // output nothing }
thanks!
try
if(value.indexof("message") != -1)
Comments
Post a Comment