I have a jQuery .load() function that finds a specific DIV in another page, I'd like to store the ID of that DIV into a variable, but I'm not entirely sure how to do it.
$('#bow_1_img').load('http://www.klossal.com/klossviolins/inventory.html .bow:first');
so this would load the contents of the first div with the class bow, .bow:first, into #bow_1_img but instead I'd like to load it's ID into a variable, any idea on how to do that?
$.get('http://www.klossal.com/klossviolins/inventory.html', function(data) {
var elem = $(data).find('.bow:first'),
bow_id = elem.attr('id');
});
$("#bow_1").click(function() {
window.location.href = "http://www.klossal.com/klossviolins/inventory.html#" + bow_id;
});
.bow:firstelement? Why do you want to load it into a variable?.loadis asynchronous.ID of that DIV" ..... what DIV ? what ID, you're loading a CLASS element. Can you try to be more specific?