/    Sign up×
Community /Pin to ProfileBookmark

problem during form submission

I have a site I’m working on for a class project [URL=”http://jimslounge.com/n2n/myStuff/finalProject/final_project.html”]http://jimslounge.com/n2n/myStuff/finalProject/final_project.html[/URL]
I have a menu at the top of the page that’s working when you click on one of the first 4 items it activates this code:

[CODE]
$(“#theQuest”).click(function(e) {
e.preventDefault();
e.stopPropagation();
$.get(‘theQuest.html’, function(data) {
$(‘#display’).html($(data));
});
});

$(“#Bedivere”).click(function(e) {
e.preventDefault();
e.stopPropagation();
$.get(‘Bedivere.html’, function(data) {
$(‘#display’).html($(data));

});
});[/CODE]

etc. …
which brings up the page beneath the menu and doesn’t follow the default link if JS is enabled on the browser.
this part works.
What I want to do is use a set of check boxes to pull out selected elements from the pages and display them in the display area.
As is when you click the Go! button it submits to the go_there function which follows:

[CODE] function go_there() {
// alert(“here we are”); this alert works so I know I’m running the script
$.get(‘theQuest.html’, function(data) {
[B]$(‘#display’).html($(‘#coconuts’, data)).append($(‘#yourDead’, data));[/B]
});
}[/CODE]

the highlighted code works I can swap it out with $(‘#display’).html($(data)); in the click handlers for the menu. I suspect I need to pass in something from the form but I don’t know what or how.

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@attaboyauthorAug 06.2011 — I've developed and simplified my question a bit.

I'm trying to get jQuery to load a div from a page into a div with id of display. I'm able to do this using a link in a menu but not using a checkbox.

this is the code:

$(':submit').click(function(e) {

if($('#coconuts').is(':checked')){

alert("coconuts is checked");

//$.get('theQuest.html', function(data) {

//$('#display').html($('#coconuts', data));

//});

}

});

If I check coconuts then click the submit button the alert notifies me so I am getting that far. This is my project so far.

http://jimslounge.com/n2n/myStuff/finalProject/final_project.html
×

Success!

Help @attaboy spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...