i have an external file profile.php, i want to load it into a sub page id profile after clicking a link.. i have tried the code below but i did not see any been displayed after the click event, the clicked event is triggered because i have tested it alert , there is no error in console i think i'm missing something please help out. thanks
$(document).on("click", "#profilel",function(){
$( ":mobile-pagecontainer" ).pagecontainer( "load", "profile.php" )
});
Try this one
$(document).on("click", "#profile",function(){
$( ":mobile-pagecontainer" ).pagecontainer( "load", "profile.php" )
});
or
$("#profilel").click(function(){
$.get("profile.php")
.done(function(data){
$( ":mobile-pagecontainer" ).html(data);
});
});
Related
So I have a table of contents section which I want to open and close during the hovering process. The problem is that I need to click to a link in that table of contents twice to make it go to the right section. All corresponding IDs in the anchor tags are okay. It's a wordpress site. Browser Chrome.
Could it be that the script is interfering and how can I correct it?
Here's the javascript I used:
(function( $ ) {
$( '.tableofcontents' ).hover(function() {
$( this ).children( 'h5' ).trigger( 'click' );
});
})( jQuery );
Try to change "hover" function to "mouseenter"
$( '.tableofcontents' ).on('mouseenter', function() {
$( this ).children( 'h5' ).trigger( 'click' );
});
I have this javascript that triggers update_cart when a quantity is changed...
jQuery('div.woocommerce').on('change', '.qty', function(){
jQuery("[name='update_cart']").trigger("click");
});
I am trying to modify it so that the trigger happens when the page loads instead, I have tried this...
jQuery( document ).ready(function() {
jQuery("[name='update_cart']");
});
But it is not working, where am I going wrong?
Try
jQuery( document ).ready(function() {
jQuery("[name='update_cart']").click();
});
I am loading a page into a div like this:
<script type="text/javascript">
$(document).ready(function(){
$("#siteloader").html('<object data="http://mysite/form1.php" />');
$( "#myform" ).submit(function( event ) {
alert( "Handler for .submit() called." );
event.preventDefault();
});
});
</script>
I can see with firefox that the page loaded is on a frame.
My question is, how can I access anything on the loaded page with jquery ?
You can try using jQuery .load() to do the same thing but only return the element that you need and not withing a frame. Jquery .load But to answer your question try using the .contents() to get the information you need. jQuery .contents
$('#siteloader').load("mysite/form1.php")
.success(function(){
$( "#myform" ).submit(function( event ) {
alert( "Handler for .submit() called." );
event.preventDefault();
});
})
EDIT: added code
I'm using an Ajax call to get a list of checkboxes to appear in a panel after the user presses login. The data loads in fine but there is no JQM styling on it, its only the default browser styling. The id of the checklist is filterlist, and the div where I want to put it is called test1.
javascript:
$(document).on('click', '#loginbutton', function() {
$( "#test1" ).load( "test.html #filterlist" );
});
Try using
$(document).on('click', '#loginbutton', function() {
$( "#test1" ).load( "test.html #filterlist" );
$( "#test1" ).trigger ('create');
});
this will apply the jquery mobile styling to the newly created elements, if it is loading a page you might try 'pagecreate' instead
I try to execute a function when I click on a specific div ID and nothing happens, help! Example:
$( "#jwplayer-1_wrapper" ).click(function() {
alert( "Handler Clicked" );
});
-> Full example here <-
Check this
http://jsfiddle.net/2mK7Z/22/
$(document).ready(function(event)
{
$('#jwplayer-1_wrapper').mousedown(function() {
alert('click detetced');
});
});
I think this is the problem you are experiencing: Track a click on a flash movie (object / embed) with jQuery
That is - the embedded flash object steals the click event, and jquery will never see it.
Do you create the element dynamically? It could be that the element doesn't exist at document ready. Try:
$("body").on("click", "#jwplayer-1_wrapper", function() {
alert("Handler clicked");
})
Otherwise, check the ID and make sure it's correct.
You have to wait for the DOM to become ready. Use jQuery(document).ready
$(document).ready(function() {
$( "#jwplayer-1_wrapper" ).click(function() {
alert( "Handler Clicked" );
});
});