It's hard to help from a little snippet posted to the forum.
It's always best to post a link to your site, or to make a demo with
jsFiddle or Plunkr. Otherwise, we are just taking guesses.
First off, what do you mean by "doesn't work"?
That's awfully vague!
Is there some JS code that goes with this that you didn't
show us?
I'd guess you might have some trouble over id="type". If
you re-load the same page, then you have a duplicate ID. Duplicating
an ID within a document is invalid, and jQuery Mobile loads all
pages into the same document. (It removes them after it no longer
needs them, but it needs the "old" page during transitions.)
Even if you think you've been careful to avoid duplicate IDs,
reloading the same page is an unavoidable edge-case. If you reload the
same page, with the same IDs, now you have duplicate IDs!
As well, the very first page loaded stays "stuck" in
the DOM, and so that's an additional edge-case.
I always recommend to avoid IDs completely in jQuery Mobile
projects, except where they are absolutely necessary (such as to tie a
label to an input where the label can't wrap the input due to UI
structure constraints - in this case, I have a back-end or static site
generator create a truly unique ID each time, and use it for nothing else).
Use CSS classes instead, and search within the active page.
Actually you are lucky you discovered this (presumably) early in
your development cycle. Other developers aren't so lucky, and only
discover what a bad idea IDs are when a user stumbles across some
specific navigation path that transitions between two pages that
happen to have duplicate IDs. By that time, a site might be hundreds
of pages, and a huge mess to fix!
IMO it is the #1 reason for badly broken/failed jQuery Mobile projects.
You don't need no stinkin' IDs!