Error Icon Displayed Incorrectly in Dynamically Generated List Items in Phonegap Android App

My attempt to dynamically create a list item with JSON response and set the data-icon to "check" is not working as expected. The result always shows "arrow-r" data-icon instead.

This is how I generate the list item:

function CallvarURL(url) {
    var respPrice ;
    $.ajax({
        url: url,
        type : "GET",
        dataType : "json",
        contentType: "application/json",
        async : false,
        success : function(msg) {
            respPrice = msg;
            $("#varList li").remove();
            $.each(respPrice.Value, function(index, value) {
                if(value.SubVar_id == 'NoDataFound' ) {
                    alert('No product is assigned to '+ localStorage.getItem('userId') +  ' for update the price please contact your admin.');
                } else {                        
                    vari = value.SrNo;
                    commVari = value.subVar_eng_name;
                    minPrice = value.Frm_price;
                    maxPrice = value.to_price;
                    var update = value.TimeCheck;
                    if (update == 'Y') {
                        $respPrice = '<li data-categoryId = "'+ vari +'" data-categoryId2 = "'+ minPrice +'" data-categoryId3 = "'+ maxPrice +'" data-categoryId4 = "'+ commVari +'"><a href="#" data-icon="star"><b class="stuff">' + commVari + '</b><br><b class="tcolour">' + minPrice + ' - ' + maxPrice + '</b></a></li>';
                    } else {
                        $respPrice = '<li data-categoryId = "'+ vari +'" data-categoryId2 = "'+ minPrice +'" data-categoryId3 = "'+ maxPrice +'" data-categoryId4 = "'+ commVari +'"><b class="stuff">' + commVari + '</b><br><b class="tcolour">' + minPrice + ' - ' + maxPrice + '</b></li>';
                        }
                     $('#varList').append($respPrice);  
                    };
                });

I'm unable to figure out why this is happening. I've tried changing the values for data-icon but it always displays "arrow-r". Any assistance would be appreciated.

Answer №1

It seems like you are utilizing jquery mobile based on your question. I have created a list with checkboxes in the following jsfiddle link. The right arrow in your code is likely due to it being included in a tag, as jquerymobile automatically adds right arrows.

Feel free to check out this jsfiddle for more details: (jsfiddle.net/4FdcY/366/) I hope this helps!

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The titanium device's back button fails to properly close my application

Currently, I am working on developing an Android mobile application using Titanium Studio. In my small application, upon logging in, two tabs are displayed on a new window. Clicking on any tab correctly opens the corresponding window. However, when I press ...

What are the main differences between Fluid Layout and Grid?

It seems like there's some vital information I haven't come across yet. Are fluid layouts and grid layouts interchangeable? I keep hearing about this baseline concept, but I can't quite grasp its purpose. Does it serve as a guide for alignin ...

Creating a notification feature for an HTML application

I am in the process of creating an HTML app through intel XDK. While I understand that using HTML to build apps is not as common, it is the language I am most familiar with, along with CSS. One feature I would like to include in my app is a weekly notific ...

Leveraging image values for selecting an image from a collection and showcasing it (Javascript)

I have a collection of images that I want to enlarge upon clicking. Here is what I currently have: <div class="gallery"> <div> <img src="content/imggallery/img1.jpg" class="oldimg" value="0"> </div> ...

How can I prevent my JSON object from serializing .NET nulls as "null" for object members?

I am currently utilizing WebMethods to retrieve an array of a custom class. When this array is returned from a Jquery .ajax call, it gets serialized into a JSON object that can be utilized with Javascript in my ASP.NET application. The issue I am facing is ...

Is it possible to utilize Ajax in jqGrid to retrieve data for a custom_element?

In my current project, I am faced with a task similar to this query where I need to create a custom edit control with a list of checkboxes. However, the twist is that I want to populate this list dynamically from the server, not hardcode it on the client s ...

Creating transparent overlay boxes with CSS grid

I'm working on a design where I need to display text information over an image. The challenge is aligning the text properly, especially when the screen size changes due to using a grid system (1140). Currently, I have a div with transparent background ...

Uploading a photo via a jQuery AJAX request to a Model-View-Controller endpoint

I am facing an issue with the following code snippet: $("#preview").click(function () { $.ajax({ type: 'POST', url: '@Url.Action("Preview")', data: { color: $("#color-picker").val(), ...

What could be causing the jQuery script file to not be detected in the Django admin panel?

While following Django's tutorial, I encountered an issue where jQuery was not loading properly. This caused collapsible fieldsets in the administration panel to malfunction. Despite installing libjs-jquery, the problem persisted. Page not found ...

CSS - Issue with aligning image captions

I created an HTML snippet that has the following structure: <div class="large-4 columns"> <div class="promo-box"> <a href="#"> <img src="/our-projec ...

Brother or sister is never empty, as every comment is considered an entity

When going through a list of jQuery objects, I want to verify if the nextSibling attribute is null. However, I found that an HTML comment also counts as a sibling object. How can I address this issue? I am looking for an if statement that will trigger fo ...

What is the process of retrieving the JSON array containing data from Reddit?

I am struggling to grasp the idea of JSON arrays and how to pinpoint a specific array from a JSON response. My objective is to retrieve the "URL" key value from the "data" objects within the "children" array at http://www.reddit.com/r/gifs/.json, but I am ...

What is the best way to emphasize the selected text in the navigation drawer with bold style?

How can I achieve the Google style navigation drawer feature where the text of the selected item becomes bold instead of using an indicator, similar to what is seen in Play Music or NewsStand? ...

The JavaScript and CSS properties are not functioning properly with the HTML text field

I came across this CodePen example by dsholmes and made some modifications: Here Furthermore, I have developed my own form on another CodePen pen: Link The issue I'm facing is related to the placeholders/labels not disappearing when typing in text f ...

Pictures fail to load on Safari browser for desktop and iPhone, yet display correctly on various other smartphones and Windows browsers

Having trouble with images not displaying on Safari browsers for Mac and iPhones, but they load fine on Windows and Android. Even after updating to the latest version of Bootstrap, the issue persists. Here are the current Bootstrap content delivery networ ...

Is there a peculiar issue with CSS float:right in IE9?

These are the styles I'm using: For the parent container: div.musicContainer { width:820px; height:54px; margin-bottom:20px; } And for the child containers: div.hardcorePlayer { width:400px; float:left; border:n ...

I am experiencing the issue of unexpected borders showing up on the HTML/CSS page that I designed

Greetings, amazing community at StackOverflow! I recently completed an HTML/CSS Project as part of a Codecademy Intensive course. If you're curious to see the project in action, feel free to check it out on GitHub by visiting this link. One thing I ...

Uncovering the "parent having two child elements" structure from HTML: A guide

I want to identify all parents with two children in an HTML document. Case 1 <parent> <child> <tag></tag> </child> <child></child> </parent> Case 2 <parent> <parent_and_child> <tag& ...

Loading screen for specific content within the current WordPress theme

I am trying to display a preloader only in the 'content' div, but it ends up hiding the entire page. The structure of the site is as follows: Title Menu Content (where I want the preloader) Footer I'm having trouble figuring out where exa ...

How can we improve the resizing of images for smaller screens?

Don't let the title fool you. Check out this code: #headerimg { background: url('http://artotek.fi/css/images/artoteklogo.gif'); background-repeat: no-repeat; background-attachment: fixed; background-position: center; border-bottom: solid ...