Reputation: 10066
All, I have the following code:
$.infinitescroll.prototype.pageNumber = $("#pagenumber_" + selector).val();
alert($.infinitescroll.prototype.pageNumber);
The alert says undefined. Here is my HTML:
<input type="hidden" id="pagenumber_.category-dj" value="20">
When I do an alert like this:
alert("#pagenumber_" + selector);
These match, why is my val() coming up as undefined?
Upvotes: 0
Views: 1164
Reputation: 4261
A period .
indicates a class in a CSS selector. One option is use an attribute selector instead to select the element by ID.
$("[id='pagenumber_" + selector + "']").val();
Upvotes: 1
Reputation: 78740
You need to escape the .
as this has a special meaning in a jquery selector. It needs to be \\.
.
Upvotes: 2