JS scripts not working for divs loaded with jQuery's .load()

JS scripts not working for divs loaded with jQuery's .load()

Content Index :

JS scripts not working for divs loaded with jQuery's .load()
Tag : javascript , By : ChrisMe
Date : November 29 2020, 04:01 AM

hop of those help? So I have div with some php inside. It is executing some records from sql database. , You need to set your on click function:
$('#records .clickingElement').on('click', function() {/*blah blah*/}) // doesn't work
$(document).on('click', '#records .clickingElement', function() {
    /*blah blah*/

No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

.mouseenter() doesn't work on content loaded with jQuerys .load() function

Tag : jquery , By : oiyto
Date : March 29 2020, 07:55 AM
To fix this issue In your case use .delegate() for elements dynamically added to #workcontent, like this:
$("#workcontent").delegate('.workitem', 'mouseenter', function() {
}).delegate('.workitem', 'mouseleave', function() {
$(".workitem").live('mouseenter', function() {
}).live('mouseleave', function() {

Load scripts after page has loaded?

Tag : javascript , By : Christopher
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , In JQuery you could do this on document ready
$.getScript("somescript.js", function(){
   alert("Script loaded and executed.");

scripts stop working for loaded form - jquery load ajax

Tag : php , By : Kuer
Date : March 29 2020, 07:55 AM
may help you . i am using drupal and ihve successfuly loaded a node creation form using jquery load function , using Drupal.attachBehaviors() we can :)
$(id).load(url, function(){

When using .load() to change a divs content do I need to re-include my scripts?

Tag : jquery , By : paolodm
Date : March 29 2020, 07:55 AM
I wish this help you When you load elements dynamically, you need to use jQuery's .on() function to bind events to the elements that are loaded. You need to bind with .on() to an element that already exists in the DOM and usually the worst case scenario for that is the body element. If you be more specific than body you'll usually get improved performance.
For example, if you loaded a table row into a table and wanted to bind the click event on the new row, you'd use:
$("table").on("click", "tr", function(event){
    //do something

Load scripts if not already loaded, and then use them

Tag : javascript , By : francisco santos
Date : March 29 2020, 07:55 AM
hop of those help? I think your problem is because myapp_init() is executed before scripts are loaded You need to manage script load event and after call myapp_init()
some like this inside each if() condition:
var myapp_script;

var scripts_loaded = 0;

  if (!window.jQuery) {
    myapp_script = document.createElement('script');
    myapp_script.src = 'http://myapp.dev/js/jquery.min.js';
    console.log('load jquery');

    myapp_script.onload = function(){
        scripts_loaded ++;
        if(scripts_loaded === 4){ //4 because in your example you have 4 scripts to load

     scripts_loaded ++;
//And so on with others if conditions
Related Posts Related QUESTIONS :
  • TypeScript interface signature "(): string"
  • Is synchronous XMLHttpRequest supported in Internet Explorer 10 and 11?
  • Axios function not returning any values with js
  • How to use firestore TIMESTAMP to create time-stamp in JavaScript
  • Instantiate subclass without constructing
  • Outputing a created object in javascript to a server side JSON file
  • Transition the numeric labels in a bar chart
  • createBottomTabNavigator: hide just one tab from the tabBar
  • iife vs simple statement behavior with document.title
  • showDialogPopup Refresh Page after Click
  • Child component does not set the initial value passed from the parent: ReactJS
  • Nodejs javascript added to button not responding
  • Trying to define a promise.all
  • Python GEE to extract featurecollection timeseries from Landsat imageries
  • How to write negative binary number?
  • Unable to set property of individual object
  • Why Named Function Expression itself cannot assign Name to another Value?
  • How to reset scroll position on single page pagination
  • How to scroll to bottom of page, when a new message is sent - Socket.io
  • How to reconstruct audio blob from a base64 encoded String?
  • How to calculate numbers within an array of objects
  • Using JavaScript to change CSS properties of SVG circles for all circles that was not clicked
  • Is there value in propTypeing repeat required properties at every level of nested components?
  • Call function if variable does not exist in a filter
  • localStorage value doesn't get updated automatically
  • React not updating state with setState correctly inside promises
  • Direct native JavaScript or jQuery method to get containing block of an element
  • Dynamic JSON object to Html Table
  • How to send Id and file to same controller?
  • How to Make a jQuery Table Cell(td) clickable to Run a Function?
  • Prevent the duplicate function onchange event jQuery
  • Reactjs Input Upload doesn't return local URL
  • An unexpected 'StartObject' node was found when reading from the JSON reader. A 'PrimitiveValue' node was expected
  • How to filter a JSON Array, with an eventListener input value at keyup
  • How to separate the different properties of filter in css?
  • Why dont work change event of bootstrap input spinner?
  • How to hide overflow text content in react
  • Is there another way to write line 6
  • Cypress - how to find by text content?
  • How to setstate for the dynamic checkboxes in a loop in react?
  • Is display:none safe?
  • How to create a form to change part of a href url of a button?
  • Put many function inside function in Javascript
  • how to exit from loop after a ajax call
  • Do Angular Reactive Form Validator.min/max check Perform Type Conversions before checking the value?
  • How to Replace Text Within Script Tags Using JQuery
  • add variable to object if not undefined using short-hand
  • How can I effectively curve my items inside a list?
  • Add new record Keyboard Shortcut on Kendo Grid Mvc
  • Time and Date running on page
  • Looping through page links puppeteer doesn't return values from the newly loaded page
  • Problem with Navigator.geoLocation.getCurrentPosition not working
  • Trying to change the id of an element with Javascript
  • Embedded Schema Inserting Blank in Meteor using Collection2
  • avoid useEffect to render at first load?
  • Why is this CSS transition only working correctly on the some clicks? How to solve it?
  • Interpolated values does not reflect the latest values in an Angular app
  • Javascript classes define attribute in constructor or outside the class
  • How to block scroll event passing through to iframe until iframe is active?
  • What is the purpose of "constructor" method in javascript?
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com