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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:01:46+00:00 2026-06-04T05:01:46+00:00

I have a code with a link , when clicking the link i want

  • 0

I have a code with a link , when clicking the link i want to do something, but i don’t know why the click doesn’t work, and the alert doesn’t even fire

jquery code

$(document).ready(function(){
    $("#editConcept").on('click','ecAddLink',function(){
        $.getJSON("http://localhost/Mar7ba/Ontology/getAllConcepts/TRUE",function(data){
            alert("William Roma");
            var options = '';
            options+="<option>Select Concept</option>";
            for(var i=0;i<data.length;i++){
                options += "<option>"+data[i]+"</option>";
            }
            $.getJSON("http://localhost/Mar7ba/Ontology/getAllRelations/TRUE",function(data){
                var options2 = '';
                options2+="<option>Select Concept</option>";
                for(var i=0;i<data.length;i++){
                    options2 += "<option>"+data[i]+"</option>";
                }
                $("#editConcept ul li:last").before('\
<li>\n\
    <p>\n\
        <label>Concept</label>\n\
        <select name="newConcepts[]">'+options+'</select>\n\
        <span class="errorMessage"></span>\n\
    </p>\n\
    <p>\n\
        <label>Relations</label>\n\
        <select name="newRelations[]">'+options2+'</select>\n\
        <span class="errorMessage"></span>\n\
        <a href="#" class="removeA">delete</a>\n\
    </p>\n\
</li>');
            });
        });
    });
});

html code

<div id="editConcept" class="container">
    <form id="ecForm" method="POST" action="<?php echo URL; ?>Ontology/conceptEdit">
        <ul>
            <li>
                <label>Select Concept</label>
                <select class="ConceptSelector1"></select>
                <span class="errorMessage"></span>
            </li> 
            <li id="ecOldRelations">
                <p>
                    <label>Old Relations</label>
                </p>
            </li>
            <li id="ecNewRelations">
                <label>New Relations</label>
                <a href="#" class="smallLink" id="ecAddLink">add new relations</a>
            </li>
            <li>
                <input type="submit" class="button1" value="save"/>
            </li>
        </ul>
    </form>
</div>

the link has an id = ecAddLink
  • 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-04T05:01:47+00:00Added an answer on June 4, 2026 at 5:01 am

    You are missing the pound sign in the selector: #ecAddLink. Most jQuery selectors are going to look like valid CSS strings, Prototype is the framework that accepts IDs without a pound sign if I remember correctly.

    Besides that, I also really hate having full URLs in the code like that, you should try to go relative and if you can’t store a webroot var globally. And I also am not a fan of so much HTML in a string (looks awful, hard to maintain/update, etc.). You should put the HTML in a hidden element in the page, or inside a script tag, easier that way IMO.

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

Sidebar

Related Questions

I have this code in the end of link button click: Response.ContentType = application/zip;
I display the div by clicking the link, but now I want to hide
I have this code to show/hide (toggle) a div when clicking a link: $('#complete-services-link').toggle(
I have a code that after clicking on a link ('#versionPageFromProdLink'), will redirect the
I want to link my two activites by clicking on a button i have
I have borrowed code from this link PHP regex templating - find all occurrences
I have come across the following link: http://code.google.com/p/a-star/source/browse/trunk/java/PathFinder.java?r=8 I have got the code working
I have some code right now that executes when a link is clicked. The
i have this code: $('.access a').toggle(function() { $('link').attr('href', 'styles/accessstyles.css'); $('body').css('font-size', '16px'); }, function() {
When I have download sample code from this link and than try to build

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.