Solved

Javascript question

Posted on 2013-10-24
1
226 Views
Last Modified: 2013-10-31
I'm abit rusty when it comes to javascript and wonder what is going on here. Specifically I wonder what is happening with this thing:
$('<a/>', {

If I want to insert a different target, like "_top", how would I do that?

Here is the code:
$(function () {      
$.getJSON(urlJson, function(data){      
var li = $('<li/>');
var icon;
$.each(data, function(key, val) {
li = $('<li/>');
$('<a/>', {
'href': "test.html?qwertyId=" + val.qwertyId,
'data-transition': "slide",
'rel': "external",
'value': val.qwertyId,
html: val.name + "</p>" + val.description
}).appendTo(li);
li.appendTo($('#qwerty-list'));
});      
$('#qwerty-list').listview('refresh');
});      
});
0
Comment
Question by:mdoland
1 Comment
 
LVL 7

Accepted Solution

by:
Ironhoofs earned 500 total points
ID: 39599815
This looks like jQuery to me. I think is a function that gets JSON data from a webserver url and renders it as a series of <li> tags. To add target="_top" to the <a> tag, try:

$('<a/>', {
'href': "test.html?qwertyId=" + val.qwertyId,
'data-transition': "slide",
'rel': "external",
'target': "_top",
'value': val.qwertyId, 
html: val.name + "</p>" + val.description
}).appendTo(li);

Open in new window

0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question