简体   繁体   中英

jPicker reset background color on reset button and how i get opened single jPicker dialog at a time?

In my jPicker i wants to reset background color and HTML reset button reset the value of textbox and jPicker has filling background color to particular textbox and its not getting reset. So my question is , Do i need to use custom any jQuery function to reset the background color also? Or HTML reset button could do that , if yes then how?

And How do it get single dialog open at a time, if page has multiple jPickers? Adding my previous question here which was unanswered till now :( I have multiple jPickers on same page ,how do i open single jPicker dialog at a time?

Attaching my code to EXAMPLE CODE

Use following jQuery Code for reset button

$(document).ready(
    function()
    {
      $('.Multiple').jPicker();
        $("#resetbutton").click(function(){
           $(".Multiple").css("background-color","rgba(0, 0, 0, 0)");
        });
    });

And use following HTML set ID in html of reset button

<input type="reset" name="reset" value="reset" id="resetbutton"/>

Changes for At a time 1 jPicker Revised HTML Code

<p>&nbsp;</p>
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>
<form>
<input class="Multiple" id="t1" type="text" value="" /><br />
    <p>&nbsp;</p>

<input class="Multiple" id="t2" type="text" value="" /><br />
    <p>&nbsp;</p>
<input class="Multiple" id="t3" type="text" value="" />
    <p>&nbsp;</p>
<input type="reset" name="reset" value="reset" id="resetbutton"/>
</form>

Revised jQuery Code

$(document).ready(
    function()
    {
        $('.Multiple').jPicker(function(){
        });

        $(".jPicker").click(function(){

            for(var i=0;i<$.jPicker.List.length;i++)
            {
                if($.jPicker.List[i].id != $(this).prev().attr("id"))
                {
                    $.jPicker.List[i].hide();
                }

            }


        });
        $("#resetbutton").click(function(){
           $(".Multiple").css("background-color","#fff");

        });
    });

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