javascript - Trouble adding horizontal scroll on dynamic table -


i'm trying following in javascript:

if (parseint($('#' + tablename + 'table').width()) > parseint($('#' + tablename + 'table').parent().width())) {                     console.log("here");                     $('#' + tablename + 'table').css('overflow-x', 'scroll');                 } 

and it's logging console there no horizontal scroll bar...

change

$('#' + tablename + 'table').css('overflow-x', 'scroll'); 

to

$('#' + tablename + 'table').parent().css('overflow-x', 'scroll'); 

the parent element 1 needs overflow-x property.

also don't need javascript functionality. can set overflow-x: auto; parent element, , add scrollbar automatically if contents wide.


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -