Solved

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

Posted on 2008-10-10
4
357 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

These days socially coordinated efforts have turned into a critical requirement for enterprises.
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

762 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

9 Experts available now in Live!

Get 1:1 Help Now