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 8631683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:15:06+00:00 2026-06-12T09:15:06+00:00

This has had me stuck for a while. My web searches regarding the onclick

  • 0

This has had me stuck for a while. My web searches regarding the onclick JavaScript call has it sometimes with a capital C as in onClick and other times onclick. My code is part of a JQuery Mobile app but the onclick is JS. So, it looks like this:

domEntry = '<li><a href="#poet-details"';
domEntry += ' onclick="getPoetDetails('+ poet_name + ')">';
domEntry += poet_name;
domEntry += '</a></li>';

I’m going to add that to a div. 'poet_name does display correctly with the 3rd line. How do I access it in getPoetDetails? Did I call it right?
Also, please see: http://jsfiddle.net/brucewhealton/XF5AJ/

The function getPoetDetails can be seen at the link given. Do I access it through an event object variable? The application sends a query string to another location, dbpedia.org/sparql, and gets back JSON. I need the poet_selected or poet_name for the second query to get details about the poet because my app is so far only listing poets, not very interesting. I want to figure this out so that I can start my app by letting the user select the nationality from among a category of "Poets_by_nationality" on DBpedia.org. My problem is capturing the user’s selection, what they click on or tap on in a jQuery Mobile app and sending it to another function.

  • 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-06-12T09:15:07+00:00Added an answer on June 12, 2026 at 9:15 am

    So you are having trouble with an onClick for your anchor tags of poet names? What I think to be the best way to do this is to not have any inline javascript. With this, when you are starting your javascript in the window ready or however you chose to do it, you should add this little line

    $('#result').delegate('a', 'click', getPoetDetails);
    

    This tells jQuery to look inside of #result and whenever there is a new anchor tag apply this click event to it. The click event should call getPoetDetails.

    Now where you are creating and inserting your anchor tags you should get rid of the javascript stuff and instead have this

    domEntry = '<li><a href="#poet-details"';
    domEntry += 'data-name="'+ poet_name + '">';
    domEntry += poet_name;
    domEntry += '</a></li>';
    

    This is giving the anchor a data value of name with the value of the poet’s name. Now you can use jQuery to get this data inside your getPoetDetails function. The start of it can now be this, and keep the rest the same.

    var getPoetDetails = function(){
    var poet_name_selected = $(this).data('name');
    // show loader
    

    I’m pretty sure you are either doing something wrong when you are calling to get your json data, or you are parsing it wrong, but now at least the name is got correctly by getPoetDetails. In order for this to be shown as working in jsfiddle you need to change the onLoad drop down to noWrap body since you already have the document ready in your js.

    I hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This has had me stuck for a long time and I have tried several
Okay people, I'm sure someone has had this issue and can help me out.
I'm aware that MD5 has had some collisions but this is more of a
Has anyone had this problem? I deleted a column in the table editor and
Has anyone had this unusual(recurring) experience before? I'm trying to check out the project
Has anyone had this problem? My projects tend to have some long XML files
This question has two parts. Part 1. Yesterday I had some code which would
This question has baffled myself and my cohorts. In the program I had written
Has anyone else had this issue and found a working solution? I've enabled the
Paul Silver had this post 7 years ago to check various browsers. Has there

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.