简体   繁体   中英

Dreamweaver CS5.5 | Slider Div Hide on 50%

I am in the process of trying to get the built in slider for Dreamweaver CS5.5 Mobile JQuery Pages to work by after the value of the slider reaches a number (in my case the number 50) or greater (50+).

Here is the code I have so far, I know it's not perfect as I'm very new to JQuery & JavaScript.

<body>
<div data-role="page" id="page4">
  <div data-role="fieldcontain">
    <label for="slider">Value:</label>
    <input type="range" name="slider" id="slider" value="0" min="0" max="100" />
  <div class="n" id="2">asdf</div>
  </div>

</div>
<script type="text/javascript">
    var val = $("#slider").slider("value");
    var box = $("#2")
    $(document).ready(function(){
        if(val > 50){
            $(2).hide()
                }
        });
</script>
</body>

Ids shouldn't start with a digit but with a letter az AZ

And as @Archer pointed selectors are strings and are put in quotes.

$('#idValue')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM