How to replace part of an input value in jquery?
Posted
by
WonderBugger
on Stack Overflow
See other posts from Stack Overflow
or by WonderBugger
Published on 2010-12-22T02:37:31Z
Indexed on
2010/12/22
2:54 UTC
Read the original article
Hit count: 168
jQuery
|find-and-replace
I've been trying to figure out a way to replace part of a string in an input value, but haven't been able to get it working.
the input field looks like this:
<input type="text" value="20,54,26,99" name="ids" />
I've tried:
$('input[name=ids]').val().replace("54,","");
and
var replit = $('input[name=ids]').val();
replit.replace("54,","");
$('input[name=ids]').val(replit);
but neither worked?
© Stack Overflow or respective owner