I use this code to order children from an ul. The select works fine but the value call in the error below. The li has a value.
for (var i = 0; i < $("#sortable").children("li").length; i++) {
sortedPlayerIds[i] = $("#sortable").children("li:nth-child(" + (i + 1) + ")").val();
}
I get this error:
TypeError: (c.value || "").replace is not a function
...d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test... jquery.min.js (linje 16)
I’m using:
1.8.16/jquery-ui.min.js
1.7.1/jquery.min.js
Any idea?
it’s problem is in finding
$(this)object in your loop, which one you get it with your counter, try this code: