function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
mac adminmac admin 

confirmation dialog box while changhing picklist value

Hi all,
In custom vfpage with standard controller, I'm showing different fields based on picklist value selection using actionsupport component with the event as onchnage. I want to show a confirmation box before changing the picklist value. I'm using ready function but it's not working for me can any one help me over here.
<script type="text/javascript">

$(document).ready(function () {

    $(".department").on("change", function () {
        var ddlBrand = $('.department');
        var value = ddlBrand.val();
        var prevValue ='prev');

        if ( value != '--Select--' && prevValue && prevValue != '--Select--') {
        var confirmval = confirm('Values entered  will reset. Are you sure you want to change the picklist value.');
            if(confirmval == true){
     'prev', value) 
                ddlBrand.val(prevValue )
  'prev', value)



Thanks in advance.

Lokesh KumarLokesh Kumar
HI Mac,

Please go through this article

Hope it will help you!