Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

6 Neutral

About Costanza

  • Rank
  1. Well the code is really just like how I described. Some elements have their title set manually inline in the html, while others do not. The latter ones have an issue with TipTip. This is only something I experience with TipTip though, not with the browser tooltip. So in terms of the js code, you'd have to look at TipTip'scode, which I linked in my OP. It's too advanced for me to comprehend but I noticed that when assigning the title, he uses the attr() function. Does this function take the default value, not a computed one? Because that would explain it.
  2. Haha no, I dumped that awful idea of mine as soon as you guys showed me that you can create custom attributes and data values. Now I use data() for that stuff. The title attribute is a normal title, the name of the item (for example: "M4 upper receiver"). The line of code is this:loadoutPage += 'BARREL: ' + $('#' + barrelID).attr('title'); That's the whole line. It's not even within an if- or for- statement or anything that could alter any variables. My code for printing to a new page (loadoutPage) works fine for creating the new page, but where the title attributes should go it prints 'undef
  3. That's exactly what I've done. I used alerts just before the line that returns undefined. The alerts display the value of suppressorID and tell me what type of object that $('#' + suppressorID)[0] is. Both return as expected: the id is the right id and the alert that tests the element type says it's a div which is true. I'm lost
  4. I think you're onto something there. What would be the solution? Because that might be what is happening because it is indeed calling this from a function (it is a user-initiated function when they click a button, not an onload or document.ready function). I should also mention that the element which I am retrieving the title of is set right in the html and loads from the start. I'm confused why this attr function would be trying to execute before I've executed the function it's contained in. I'm not getting an actual undefined error--the result of the attr() function is just returning undefin
  5. Yeah it all checks out. suppressorID returns the correct value (the id of the element I want) and $('#' + suppressorID)[0] says it's a div element, which is correct. If all that works, then how could the attr() function not possibly work? Weird.
  6. For some reason this code keeps returning 'undefined'. $('#' + suppressorID).attr('title') But I've tested the value of suppressorID and it returns the expected value, and the tooltip for the div works fine. What's weird is that this is such a basic function and nothing in my code alters the title attribute of these elements. I even used ctrl+F to search all my javascript for any other places which affect the title attribute in case I accidentally inserted something, but there was nothing. Where should I go from here in terms of testing to figure out the source of the problem? I don't know w
  7. So after further testing I've learned this: --TipTip works on some elements of mine, but not all.--It works on ones that have a title explicitly set inline in my html.--It does NOT work in ones that have their title attribute set by javascript. For these ones, it has a small, empty tooltip. then if I rollover an element that works, and then rollover an element that doesn't work, it appears to work but it displays the title of the most recently rolled-over element that worked. I guess this functionality makes sense, but is there a way to make it work with non-default titles? If not, I can deal
  8. Oh man, sorry, I had just linked the css for the plugin incorrectly. However, now I am experiencing an issue with it where it simply doesn't display any content (it's supposed to display text: the title attribute of the element). The default browser tooltip works fine if I remove the plugin, but TipTip doesn't.
  9. I'm trying to use this beautiful plugin called TipTip. But on my page when I activate the script, my entire page suddenly gets shoved down about 700-800 pixels then jumps back up a second later, and no tooltip appears. The elements that I am trying to use this on are divs that are positioned absolutely, which each are contained inside their own individual container div that is positioned relatively (and is the same size). I'm betting that my positioning is what' s causing the problem but I don't know why because I'm not the guy who wrote the plugin and I can't understand a word of his code. He
  10. Thanks! So the prop() method would be incorrect as well? I think I'll take your advice and just use data() and see how that goes.
  11. I have some if-statements that are like this: if ($('#' + handguardID).attr('hasSixRail')) I set the attribute hasSixRail to either true or false (no quotes) depending on the element but this if-statement always evaluate to true, even when the attribute is set to false. (alert window testing confirms so). So then I tried changing it to this: if ($('#' + handguardID).attr('hasSixRail') == true) But that always evaluates to false. I guess I could just change everything to strings if that would solve the problem (I did a test with changing one element's attribute into a string and it seemed
  12. Thank you dsonesuk and Ingolme! How did I not know that? Well that makes my life a heck of a lot easier. I'm going to look into jQuery's documentation on adding attributes like you've shown there and see how this goes. Thanks again!
  13. I guess because css attributes are the only way i know how to do that lol. (besides global variables but I need properties that are attached to elements). Because what I actually need are custom attributes. (what I'm creating is not actually a page layout. It's a thing like Brownells.com's ar-15 creator, sort of) So I'm using properties that won't affect my page as a way to have 'custom' properties. I know, it's truly terrible and nuts, but I thought it was my only option. This seems like it's what I really need though: creating my own objects. That way I can create custom properties. I
  14. Ah ok, thank you! Now I'm screwed though because I need css attributes that won't affect the element their assigned to (weird, I know). So far, attributes like line-height, text-indent, etc have worked perfectly. but if border requires an actual visible border then I can't do what I need to do because I can't have a border (whereas text attributes don't require any text to actually be on the page). Is there away in javacript/html to add element/object specific variables, like in an object-oriented language? For example, if I could create attributes that don't already exist but later access th
  15. I'm at the end of my rope here, this is driving me nuts. Why does this keep returning the wrong value? The variable endOfSixRail keeps getting assigned the wrong value because 'border-right-width' keeps returning as 0px even though it's explicitly assigned the value of 708px. (Note: I'm using jQuery here) endOfSixRail = $('#' + handguardID).css('border-right-width');alert(handguardID + ' ' + $('#' + handguardID).css('border-right-width') + ' endofsixrail: ' + endOfSixRail); handguardID checks out and returns the correct string so I have no idea how the rest doesn't also return the right val
  • Create New...