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

java - How to Configure JAXRS and Spring With Annotations -

visual studio - TFS will not accept changes I've made to a Java project -

php - Create image in codeigniter on the fly -