Last active
January 1, 2017 03:42
-
-
Save ederrafo/c682b3a4aeb1cbd3ba83 to your computer and use it in GitHub Desktop.
jquery javascript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*Check jQuery is defined*/ | |
> typeof jQuery | |
> window.jQuery | |
/******************************************** | |
* jquery ajax progressbar | |
********************************************/ | |
function GetProgress() { | |
$.ajax({ | |
url: "percentage.php", | |
success: function (result) { | |
console.log(result); | |
var pers = result; | |
$("#progressbar").progressbar("value", pers.value); | |
if (pers.value > 0) { | |
isDone = true; | |
} else { | |
setTimeout(GetProgress, 2000); | |
} | |
} | |
}); | |
}; | |
jQuery(function () { | |
//initialize the plugin | |
$("#progressbar").progressbar(); | |
GetProgress(); | |
}) | |
/*************************************************************** | |
* How to select the first element in the dropdown using jquery? | |
***************************************************************/ | |
$('select#cities option:first-child').attr("selected", "selected"); | |
var myDDL = $('myID'); | |
myDDL[0].selectedIndex = 0; | |
$("#cities").val($("#cities option:first").val()); | |
$("#target")[0].selectedIndex = 0; | |
/******************************************** | |
* Selectbox reset | |
********************************************/ | |
$("#target").prop("selectedIndex", 0); | |
/* Work in chrome, firefox */ | |
$("#cities").val(null); | |
/* Recorrer un li */ | |
$( "#secondary > ul > li" ).each(function( index ) { | |
if($( this ).children().length == 0) { | |
$(this).remove(); | |
} | |
}); | |
/* | |
http://www.456bereastreet.com/archive/200704/how_to_prevent_html_tables_from_becoming_too_wide/ | |
http://api.jquery.com/category/selectors/ | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment