Support

Account

Home Forums Front-end Issues jQuery to trigger on click event.

Solved

jQuery to trigger on click event.

  • Totally non-standard issue.
    I have a site that I want a button in one place to trigger an acf-checkbox.

    I’ve got it all working, however on checkboxes that trigger conditional logic to reveal a textbox other hidden field it doesn’t push down the container – just extends behind the next elements.

    I’ve been looking though the docs trying to see if I should do this some other way, but its not clear to me yet

    perhaps there is a better way to call this.
    https://www.faithnfm.info/
    click next steps / I have decided to follow Jesus
    to see what I Mean

    
    $("#follow-jesus").on("click", function() {
    
    		$(".faith-accordion-header.active").removeClass("active").next().slideToggle(300);
    		
    		var id = $("panel-connect");
    		var elem = document.getElementById(id);
    		
    		$("#panel-connect").toggleClass("active").next().slideToggle(400, function(){
    			
    			$('html, body').animate({scrollTop: $(elem).offset().top-115}, 800);
    			
    		});
    		
    				setTimeout(
                function() {
                    $("input[value='Prayer Request']").parent().click();
                },
                500);
    		//Below solves one issue, creates another - thought the issue might be caused since JS processes the click before it changes the value.
    		//$("input[value='Prayer Request']").prop("checked",true)[0].onclick();
    		
    		
    	});	
    
  • Solved my issue. Just a syntax error. I added a $

    var id = $("panel-connect");
    should be

    var id = ("panel-connect");

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘jQuery to trigger on click event.’ is closed to new replies.