Reputation: 4187
I have a small demo:
<div class="box_content_height">
<strong>Height: </strong>
<input type="text" name="height" id="height" value="300" />px
<input type="submit" class="submit_advance" value="submit" />
</div>
And javascript
$('.submit_advance').click(function() {
var height_css = $('#height').val();
$('ul.nav-scroll').css('max-height', height_css+'px');
});
When I type input = 500 is result css no change 500 How to result is
.ul.nav-scroll {
max-height: valueofinput+px
}
Upvotes: 1
Views: 115
Reputation: 578
is this a typo? Your css definition has a "." in front of ul:
.ul.nav-scroll { max-height: valueofinput+px }
your javascript selector does not correspond with the above:
$('ul.nav-scroll').css('max-height', height_css+'px');
Your css should be:
ul.nav-scroll { max-height: valueofinput+px }
Upvotes: 0
Reputation: 78920
Your submit
may be causing the page to reload due to the form being submitted, undoing your changes. If you don't want this to happen, add a return false
to the end of your handler.
Upvotes: 1
Reputation: 737
change this :
$('ul.nav-scroll').css('height', height_css+'px');
Upvotes: 1