jQuery help
- Started
- Last post
- 5 Responses
- bort
This is probably really simple but I'm having a rough time getting this thing working. I'm using the simple modal plugin: http://www.ericmmartin.com/projeā¦
I have the following link in my mark-up:
<a class="iconVirtualTour" href="../images/galleries.gif"><span>Click here blah blah</span></a>
This is the script I'm using:
$(document).ready(function() {
var linkValue = $(this).attr('href');
$('a.iconVirtualTour').click(fun... {
e.preventDefault();
linkValue.modal();
});
});I just want the value of the href attribute passed to the modal window (in this case the galleries.gif).
Both jQuery and the plugin js is included. Little help? What am I doing wrong?
- acescence0
var linkValue = $(this).attr('href');
that has to be inside the click function. as it is, "this" is referring to document, not your anchor
- bort0
Hmmmm. I've moved it inside the click function and still no dice.
- acescence0
oh, i didn't actually read that page you linked...
"As a chained jQuery function, you can call the modal() function on a jQuery element and a modal dialog will be displayed using the contents of that element."
this means you have to pass it a reference to an html element, like a div. you then have to separately load the content using the jquery load method and target that same element.
- acescence0
basically something like this...
- bort0
Thanks dude. You always provide good code help.