Shantanu Mahajan
Shantanu Mahajan

Reputation: 199

Jquery is not working in salesforce

Hii all,

I am trying to develop Range Slider in my VF page but it is not working. I am sharing my code with you.I am trying range slider which will show values on change when slider will move it will show values on that slider.

Thanks in advance!!

apex:page standardController="Opportunity" sidebar="false">

 script>
  $(function(){
    $("#slider-vertical").slider({
        orientation: "horizontal",
        range: "min",
        min: 0,
        max: 100,
        value: 60,
        slide: function( event, ui ) {
            $( "#amount" ).val( ui.value );
            $(this).find('.ui-slider-handle').text(ui.value);
        },
        create: function(event, ui) {
            var v=$(this).slider('value');
            $(this).find('.ui-slider-handle').text(v);
        }
    });    
});
 /script>

 script>
 #demo { padding: 10px !important; }
 /script>

 div class="demo">
    div id="slider-vertical">``</div>
/div>

/apex:page>

Upvotes: 1

Views: 875

Answers (1)

sheilak
sheilak

Reputation: 5873

See Salesforce documentation on Developing Apps with jQuery

You need to reference at least the jQuery and jQuery UI libraries

<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js" />
<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.js" />

You also need to use jQuery's no conflict mode and use j$ in place of $

j$ = jQuery.noConflict();

Also the CSS looks like it should be inside a '<style>' tag and with .demo selector.

There is some weirdness with the code you've posted that it's missing all <

Upvotes: 2

Related Questions