Solved

Ajax form won't submit in ie after modifying css with javascript

Posted on 2008-10-10
4
359 Views
Last Modified: 2013-12-25
I have a form that submits, in both IE7 and FF, but only works in FF. I have isolated the case down to two lines of code in the javascript, however, i need to hide these fields and have the form function as normal.
The reason i can't muck with the HTML/PHP, is because these fields I'm trying to hide need to be on the form, but the data is pulled from another field and placed into those.

//javascript jquery code
$j('#titlediv').attr({ style: "position:absolute;top: -1000px;" }); //hide title div
$j('#postdivrich').attr({ style: "position:absolute;top: -1000px;"}); //hide post div

I've tried doing this the same way with document.getElementById(element).className = 'hideme', but the exact same results occur.
0
Comment
Question by:kevques
  • 2
4 Comments
 
LVL 11

Accepted Solution

by:
bansidhar earned 250 total points
ID: 22688019
try using

document.getElementById(element).style.display='none';

or better use hidden field
<input type="hidden" name="yourelementname" value="" />
0
 
LVL 82

Assisted Solution

by:hielo
hielo earned 250 total points
ID: 22688037
what is $j() doing? Unless you aliased that function, it should be either:
$jQuery('#titlediv').attr({ style: "position:absolute;top: -1000px;" }); //hide title div
$jQuery('#postdivrich').attr({ style: "position:absolute;top: -1000px;"}); //hide post div

OR:
$('#titlediv').attr({ style: "position:absolute;top: -1000px;" }); //hide title div
$('#postdivrich').attr({ style: "position:absolute;top: -1000px;"}); //hide post div
0
 
LVL 11

Expert Comment

by:bansidhar
ID: 22688102
i don't like some element at top: -1000px; creating unnecessary load on the browser when there is much cleaner methods available for hiding an element :)
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question