Necessity: find a way to add the correct tag / attribute / property to a regular html control.
I have javascript / jquery adding a click event to a link that will show or hide the div. The idea is to do this using $ (document) .ready and an anonymous method to create a method called onClick when the page loads. Clicking on the div will display the text. This is all good and good, except that I cannot figure out how to adjust the text so that it can be done when the page loads. I would like something like:
<a href="..." class="showItLink" textToShow="This is the text to show">HI</a>
so that I can do this:
$(document).ready
(
function()
{
$("..showItLink").click
(
function(event)
{
var containerPosition;
var createdDiv;
createdDiv = $(this).children(".postComment");
if (createdDiv.length == 0)
{
createdDiv = CreateDiv(this.textToShow, "postComment");
$(this).append(createdDiv);
$(this).children(".postComment").hide();
}
$(createdDiv).toggle();
event.preventDefault();
}
);
}
);
, xhtml valid (meh), IE. Firefox , . (this.textToShow) - rel rev, . , .
comment = $(".showItLink").attr("comment");
...
createdDiv = CreateDiv(comment, "postComment");
:
<a href="http://www.theironical.com" class="showItLink" comment="hihihi" >HI</a>