Click here to Skip to main content
13,090,299 members (76,306 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hai Everyone
jQuery not work in Google Chrome,but it work in ie8,fire fox.
My actual process is i want change the height and width of the table .My JQuery code is

function InitLoad() {
    var w = $(window).width();
    var windowHight = $(window).height() - 123;
    if (PageTitle == "Default.aspx") {

        $(".centertbl").css({ "height": windowHight + "px" });
        $(".centertbl").css({ "width": w + "px" });
        $(".fowi").css({ "width": w + "px" });
i call .centertbl as class in html table
<table class="centertbl"  width="100%"  
style="background-color: #C0C0C0; overflow: hidden; margin :0px">
                     <td style="padding-removed 1%; height: 5px" colspan="2"></td>

the above code worked for change the height and width based on browser inner height and width for table,if i run in ie8 and mozila it will work.i.e it will dynamically change height and width,but i chrome it not work pls reply how to solve this problem and also support all browser.

Pls reply asap

Posted 13-Jul-13 8:01am
ryanb31 13-Jul-13 22:07pm
You'll have to use chromes developer tools to figure out why.
Why are you using style class and element-embedded style (via the attribute "style")? Even though it's technically possible, it looks like a pretty big abuse. No wonder you can easily mess up things the way some layout engines are confused.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Please see my comment to the question. Try to use only the style referenced through the HTML element class. I cannot guarantee that it immediately resolves your problem, but this is the way to sort things out properly. You should opt for consistent style programming in all cases, even if you did not have your present problem. So, please try.

Aravindba 14-Jul-13 9:21am
can u write bit of code here ?
centertbl is available in master page using javascript i change widht and height dynamically,in page init it change all child page.
Sergey Alexandrovich Kryukov 14-Jul-13 23:19pm
What can I possibly write here?
I advised you to remove slyle="..." and move the content (in quotation marks) to CSS.
From your question, I guessed you know CSS or... don't you?
Aravindba 14-Jul-13 23:26pm
why u say remove style ? i am not ask about style="...." ,i am asking about class(class="centertbl" ) and i find solution for support for all brower.
my old code is $(".centertbl").css({ "width": w + "px" }); and i change to $(".centertbl").css("width", w + "px");.
did u find and different ? just i remove whole barcket.Before u reply first u read question clearly and question is jquery not work in chrome only and specified place(class="centertbl") for change height and width and i not ask about background color,overflow or margin.
Because having a mess is a source of problems, including incompatibilities. And did you spot the difference between "remove" and "move"?
Have all styles in CSS, just try.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.170813.1 | Last Updated 14 Jul 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100