I am currently using jquery to regularly speak to my serverside to "import" a html fragment (which has varying components depending on user selection).
What I want to know is:
Is there any way I can access the html within that div through jquery?
TOP LEVEL PAGE
<div id = "window">
<p> loading...</p>
</div>
<script>
function update() {
var number = $("#number_within").val();
alert(number);
setTimeout('updateFeed()', 5000);
}
update();
</script>
"WINDOW" PAGE
<input type = "hidden" id = "number_within" value ="17" />
when I run this the alert in the top page simply says undefined and doesn't return the value (17). Is there any way I can retrieve this?
I'm busy experimenting with jquery at the moment for a website I'm trying to put together.
I have a bunch of links which fire a jquery function as follows:
<a href="#" class = "spam" onclick="return changeValue('1');">Spam</a>
<a href="#" class = "spam" onclick="return changeValue('2');">Spam</a>
<a href="#" class = "spam" onclick="return changeValue('3');">Spam</a>
where each link refers to a specific item on the page (which you can mark as spam). What I want to do is disable the link after it has been clicked once (a la google groups).
my js function looks as follows:
function changeValue(postid){
$.post("/mark_as_spam",
{postid: postid}
);
return false;
}
is there a way I can identify the referring link and disable it with the link text reading "spammed" or some such?
Everything works fine in chrome, ie and firefox but I've just tested it in Safari and it fails. The Alert fires fine, includes all the right html markup however the line $(this).html(options); doesn't update the select html element (this) as is required.
My question is this: is there either a way to fix this, or a way to do it that doesn't use $(this).html(options) ?