[jQuery] Replacing a string - why doesn't this work?
<html>
<body>
Can someone tell me/show me what I'm doing wrong here please?
I'm duplicating a fieldset that contains an input form. However,
within this fieldset lies the string:
<a href="#" onclick="showImageList(x);.....
... where (x) is the zero-based number of the fieldsets in the overall
form.
So, for example, if x = 2, then what I'm trying (and failing) to do is
replace the string "showImageList(2" with
"showImageList(3"
<tt><x-tab> </x-tab>var
clonedRow = $( "#sshow_input fieldset:last" ).clone();
<x-tab> </x-tab>var iRowID
= parseFloat(clonedRow.attr("id").substr(-1,1));
<x-tab> </x-tab>var
iCurrentOrder = $( "#iOrder"+ iRowID ,
clonedRow).attr("value");
<x-tab> </x-tab>
iCurrentOrder = parseFloat(iCurrentOrder);
<x-tab> </x-tab>
//$.log(iCurrentOrder);
<x-tab> </x-tab>iNewID =
iRowID + 1;
<x-tab> </x-tab>
//$.log('iNewID=' + ' ' + iNewID );
<x-tab> </x-tab>
s=clonedRow;
<x-tab> </x-tab>var
myString = 'showImageList'+iRowID;
<x-tab> </x-tab>var
myString2 = 'showImageList'+iNewID;
<x-tab> </x-tab>var
myString3 = s.replace(myString,myString2);
</tt>The error message I get is s.replace is not a function.
Can someone spot my mistake, or suggest an alternative approach
Thanks
Bruce</body>
</html>