Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2008-10-10
4
Medium Priority
?
367 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 11

Accepted Solution

by:
bansidhar earned 1000 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 1000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
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…
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…

660 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