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

  • Home
  • SEARCH
  • 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 5945565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:41:59+00:00 2026-05-22T16:41:59+00:00

I am trying to expand on some code written by someone else, but I

  • 0

I am trying to expand on some code written by someone else, but I am having trouble using one of the javascript variables. If I set it in the title of a div or something similar like so:

$("#test12").attr("title" , ccode);

then it works fine and the title of the div is ‘CA’, which it should be. But if I try to put it into the text area of the div, then it tries to run a function or something but I can’t see where it’s doing it.

Is there a way I can convert it to simple text and stop it from running any functions?

Thanks for any help

Edit:

This is all of the code I can see at the moment:

<script>

//<!--
function loadForeignOffices(ccode){

    //load window with details...
    $('#iframe_3').attr("src", "<?php echo $html->url("/", true); ?>erc/maps/contacts/"+ccode);
    $("#test12").attr("title" , ccode);



}
//-->
</script>

Basically what I’m trying to do is use the ccode variable because I want to display CA on the screen, but when I try to do that it seems to run some other function and fails, and doesnt show CA.

  • 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-22T16:42:00+00:00Added an answer on May 22, 2026 at 4:42 pm

    You may need to brush up on your jQuery dot-operators:

    .load() is an ajax call that will load the contents of () into the selected element. In one of your comments you mention you are trying to do this $("#test12").load(ccode); which is inherently silly, if ccode is the string “CA”

    .attr() will change the attributes of the selected element. If you are trying to display “CA”, $("#test12").attr("title" , ccode); this will clearly not accomplish that — As “CA” is added to the title attribute. As in <div id="test12" title="CA"></div>

    Perhaps what you are looking for is .html() which inserts the string into the selected element. Or even .innerText()

    Why don’t you spend some time reading the jQuery documentation. A little bit goes a long way!

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

Sidebar

Related Questions

I'm trying to expand on an idea from someone else's question, and running into
I'm trying to expand and collapse a <div> by clicking some text inside the
I've got some code that uses toggle to show and hide a div, but
I've added some expand/collapse functionality to a table with jQuery and I'm now trying
I'm using Visual Studio 2008 trying to debug a C# project. I had some
I'm trying to save some time / make my code readable. I have a
I'm getting something pretty strange going on when trying to read some data using
I am trying to create 3 table view cells using code (w/o nib). I
I am trying to read some code that has a lot of macros in
I'm having a hard time trying to figure out how to solve some jQuery

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.