Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6883139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:20:40+00:00 2026-05-27T05:20:40+00:00

I have a big problem: I have a listview and each item links to

  • 0

I have a big problem: I have a listview and each item links to page #concorsi. When I click on a link the URL become #concorsi?numero=1 because I’m fetching the form number 1 from a JSON.

When I click the first time it’s all OK. Each input is visualized with jQuery Mobile classes but if I come back and after go into the same link the code don’t refresh.
The header is well visualized but the content no. How can I force the refresh of the div content?

These are my JavaScript functions:

<script type="text/javascript">
$(document).bind( "pagebeforechange", function( e, data ) {
    // We only want to handle changePage() calls where the caller is
    // asking us to load a page by URL.

    if ( typeof data.toPage === "string" ) {
        // We are being asked to load a page by URL, but we only
        // want to handle URLs that request the data for a specific

        var u = $.mobile.path.parseUrl( data.toPage ),
            re = /^#concorso/;
        if ( u.hash.search(re) !== -1 ) {
            // We're being asked to display the items for a specific category.
            // Call our internal method that builds the content for the category
            // on the fly based on our in-memory category data structure.
            showConcorso( u, data.options);
            // Make sure to tell changePage() we've handled this call so it doesn't
            // have to do anything.
            e.preventDefault(); 
        }
    }
});
</script>

And showConcorso()L

function showConcorso( urlObj, options )
{
    document.getElementById('conccont').innerHTML="";
    var concorsoNum = urlObj.hash.replace( /.*numero=/, "" ),

        // Get the object that represents the category we
        // are interested in. Note, that at this point we could
        // instead fire off an ajax request to fetch the data, but
        // for the purposes of this sample, it's already in memory.
        concorso = obj.concorsi[ concorsoNum ],

        // The pages we use to display our content are already in
        // the DOM. The id of the page we are going to write our
        // content into is specified in the hash before the '?'.
        pageSelector = urlObj.hash.replace( /\?.*$/, "" );

    if ( concorso ) {
        // Get the page we are going to dump our content into.
        var $page = $( pageSelector ),

            // Get the header for the page.
            $header = $page.children( ":jqmData(role=header)" ),

            // Get the content area element for the page.
            $content = $page.children( ":jqmData(role=content)" ),
            $footer = $page.children( ":jqmData(role=footer)" );



        // Find the h1 element in our header and inject the name of
        // the category into it.
        $header.find( "h1" ).html(concorso['title']);

        markup=document.createElement('form');
        markup.setAttribute('action','#home');
        markup.setAttribute('method','POST');
        markup.id="concForm";
        markup.onchange="alert (test)";
        items=obj.concorsi[concorsoNum].elementi;

        for(field in items) {
            nest=items[field];
            nest=obj.campi[nest];
            switch(nest.type){
                case "free": markup.appendChild(createFree(nest));
                            break;
                case "text": markup.appendChild(createText(nest));
                            break;
                case "textarea": markup.appendChild(createTextArea(nest));
                            break;
                case "switch": markup.appendChild(createSwitch(nest));
                            break;
                case "switchcust": markup.appendChild(createSwitchCustom(nest));
                            break;
                case "slider": markup.appendChild(createSlider(nest));
                            break;
                case "select": markup.appendChild(createSelect(nest));
                            break;
                case "checkbox": markup.appendChild(createCheckbox(nest));
                            break;
                case "radio": markup.appendChild(createRadio(nest));
                            break;
                case "reset": markup.appendChild(createButton(nest));
                            break;
                case "submit": markup.appendChild(createButton(nest));
                            break;
            }
        }

        // Inject the category items markup into the content element.
        $content.html( markup );

        // Pages are lazily enhanced. We call page() on the page
        // element to make sure it is always enhanced before we
        // attempt to enhance the listview markup we just injected.
        // Subsequent calls to page() are ignored since a page/widget
        // can only be enhanced once.

        $page.page();


        // We don't want the data-url of the page we just modified
        // to be the url that shows up in the browser's location field,
        // so set the dataUrl option to the URL for the category
        // we just loaded.
        options.dataUrl = urlObj.href;

        // Now call changePage() and tell it to switch to
        // the page we just modified.
        $.mobile.changePage( $page, options );
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T05:20:40+00:00Added an answer on May 27, 2026 at 5:20 am

    To refresh the page user:

    .trigger('create');
    

    More Here:

    • http://jquerymobile.com/demos/1.0/docs/pages/page-scripting.html

    Create vs. refresh: An important distinction
    Note that there is an important difference between the create event and refresh method that
    some widgets have. The create event is suited for enhancing raw markup
    that contains one or more widgets. The refresh method should be used
    on existing (already enhanced) widgets that have been manipulated
    programmatically and need the UI be updated to match.

    For example, if you had a page where you dynamically appended a new
    unordered list with data-role=listview attribute after page creation,
    triggering create on a parent element of that list would transform it
    into a listview styled widget. If more list items were then
    programmatically added, calling the listview’s refresh method would
    update just those new list items to the enhanced state and leave the
    existing list items untouched.

    You can also refresh the listview like this:

    $('#mylist').listview('refresh');
    

    More Here:

    • http://jquerymobile.com/demos/1.0/docs/lists/docs-lists.html

    Updating lists
    If you add items to a listview, you’ll need to call the refresh() method on it to update the styles and create any
    nested lists that are added. For example:

    $('#mylist').listview('refresh');
    

    Note that the refresh() method only affects new nodes appended to a
    list. This is done for performance reasons. Any list items already
    enhanced will be ignored by the refresh process. This means that if
    you change the contents or attributes on an already enhanced list
    item, these won’t be reflected. If you want a list item to be updated,
    replace it with fresh markup before calling refresh.

    Refreshing Form Elements:

    • http://jquerymobile.com/demos/1.0/docs/forms/docs-forms.html

    Refreshing form elements
    In jQuery Mobile, some enhanced form controls are simply styled (inputs), but others are custom
    controls (selects, sliders) built from, and kept in sync with, the
    native control. To programmatically update a form control with
    JavaScript, first manipulate the native control, then use the refresh
    method to tell the enhanced control to update itself to match the new
    state. Here are some examples of how to update common form controls,
    then call the refresh method:

    Checkboxes:

    $("input[type='checkbox']").prop("checked",true).checkboxradio("refresh");
    

    Radios:

    $("input[type='radio']").prop("checked",true).checkboxradio("refresh");
    

    Selects:

    var myselect = $("#selectfoo");
    myselect[0].selectedIndex = 3;
    myselect.selectmenu("refresh");
    

    Sliders:

    $("input[type='range']").val(60).slider("refresh");
    

    Flip switches (they use slider):

    var myswitch = $("#selectbar");
    myswitch[0].selectedIndex = 1;
    myswitch.slider("refresh");
    

    Collapsible:

    $('div[data-role=collapsible]').collapsible();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a big problem using highcharts, because I have been trying for hours
I have big problem because i dont uderstand properly how make my homework. Well
I have a big problem. There are devices in live that send the URL
I have big problem with file_get_contents. When I do for example: $url=2 $linkk =
I have big problem when I am trying to deploy my app over clickonce.
I have a big problem. I want to extract text from html table that
I have a (big) problem that all of you that work with Webforms might
I have a big problem dealing with data I try to download in my
I have an big problem with an SQL Statement in Oracle. I want to
I am using gettext in my PHP code, but I have a big problem.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.