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

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -