Skip to content Skip to sidebar Skip to footer

Increase Element Width Using Jquery Or Js

So I have multiple elements with class name ml, all different widths because of different text contents (not set in CSS). for example:
  • Solution 1:

    Solution 2:

    In your code:

    var curr_width = elems[i].width();
    

    resolve to an undefined value, because DOM object doesn't have width property (only jQuery object have this one).

    So the next statement (curr_width+num) is incorrect because you want to add an undefined value with a number.

    Post a Comment for "Increase Element Width Using Jquery Or Js"