Solved

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

Posted on 2008-10-10
4
358 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
The viewer will learn how to count occurrences of each item in an array.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

920 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now