0

I am not adding it through a separate vf resource even.

I am directly writing HTML on the page.

<script>
$.noConflict();
(function($){
    function floatLabel(inputType){
        $(inputType).each(function(){
            console.log("jQ Running");
            var $this = $(this);
            // on focus add cladd active to label
            $this.focus(function(){
                $this.next().addClass("active");
                console.log("jQ active added");
            });
            //on blur check field and remove class if needed
            $this.blur(function(){
                if($this.val() === '' || $this.val() === 'blank'){
                    $this.next().removeClass();
                    console.log("jQ active removed");
                }
            });
        });
    }
    // just add a class of "floatLabel to the input field!"
    floatLabel(".floatLabel");
})(jQuery);
</script>

it does not work at all.

anyone know why?

1
  • 1
    Have you examined your browser console for errors? Commented Feb 22, 2017 at 2:13

1 Answer 1

-3

solved it.

it was pretty basic.

but now works. thanks guys. and it never even loaded by console values.

thanks.

<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js" />
<script>
var j$ = jQuery.noConflict();
j$(document).ready(function(j$){
    function floatLabel(inputType){
        j$(inputType).each(function(){
            console.log("jQ Running");
            var j$this = j$(this);
            // on focus add cladd active to label
            j$(this).focus(function(){
                j$(this).next().addClass("active");
                console.log("jQ added active class");
            });
            //on blur check field and remove class if needed
            j$(this).blur(function(){
                if(j$(this).val() === '' || j$(this).val() === 'blank'){
                    j$(this).next().removeClass();
                    console.log("jQ removed active class");
                }
            });
        });
    }
    // just add a class of "floatLabel to the input field!"
    floatLabel(".floatLabel");
})(jQuery);
</script>
2
  • Please add some text explaining what you actually fixed and why it didn't work. Commented Feb 22, 2017 at 2:24
  • Please edit your post to be more clear...that's not what comments are for. Commented Feb 22, 2017 at 2:30

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.