jquery event for elements added to DOM later
$(document).on('click', '#editProfile',function(){ ///code stuffs });

ellievsbear
we're not kids anymore.
cherry valley forever

Product Placement

pixel skylines
let's talk about Bridgerton tea, my ask is open
RMH
Aqua Utopia|海の底で記憶を紡ぐ
Jules of Nature

roma★
One Nice Bug Per Day
Alisa U Zemlji Chuda
NASA
Stranger Things
Cosmic Funnies

blake kathryn
Game of Thrones Daily
Lint Roller? I Barely Know Her
noise dept.

Discoholic 🪩
seen from United States

seen from Türkiye
seen from Australia

seen from Türkiye

seen from Germany

seen from United States
seen from Netherlands

seen from Türkiye

seen from Pakistan

seen from Singapore
seen from United States

seen from Malaysia

seen from Portugal

seen from Malaysia

seen from Malaysia
seen from Germany

seen from Germany

seen from United States
seen from Malaysia
seen from Argentina
@webdevbyfire
jquery event for elements added to DOM later
$(document).on('click', '#editProfile',function(){ ///code stuffs });
SQL Compatiblity Level after upgrade
We went from MSSQL 2000 to 2008 http://blog.sqlauthority.com/2008/10/21/sql-server-fix-error-incorrect-syntax-near-you-may-need-to-set-the-compatibility-level-of-the-current-database-to-a-higher-value-to-enable-this-feature-see-help-for-the-stored-procedure-sp_db/
Building an Object in JavaScript
var sc = {}; //build li collection var fullList = $('#list li'); fullList.each(function (){ var theKey = $(this).attr("id"); sc[theKey] = $(this); });
jquery .each and arrays
I had to find siblings with class 'name' and grab their content. Then created an array of those names.
var att = new Array(); $('.conflict').each(function(i){ att[i] = $(this).siblings('.name').html(); }); var counter = 0; for (counter=0; counter");
Grabbing data from your URL with javascript
All credit to Quentin on this one:
I needed a form to grab some data from the page URL and submit the form onLoad. I found this code to grab the data:
var QueryString = function () { // This function is anonymous, is executed immediately and // the return value is assigned to QueryString! var query_string = {}; var query = window.location.search.substring(1); var vars = query.split("&"); for (var i=0;i
I added a binary to tell the form to load along with the data field, which in my case was an email.
So the URL is: http://www.thisistherealurl.com?valid=1&[email protected] added the code:
if(QueryString['valid'] == 1) { $('#email').val(QueryString['email']); sumbit_function(); }
I love how easy it is to access the different fields in the URL. Thanks, Quentin! This is a great script to learn from.
.mp4's on IIS
I created an .mp4 for iProducts from a WMV and uploaded it to our web server running IIS6. The link to the file wasn't working. I was getting 403's not 404's so I knew something had to be up.
A few quick Google searches revealed that .mp4 files most likely weren't an approved MIMI type in my IIS6.
So I found out how to add them.
Select the site to configure in IIS, right click and select "Properties"
Under HTTP Headers Tab, select "File Types" under the MIME Map section and select "New Type"
Type ".flv" as the associated extension and "video/x-flv" as the content type or "flv-application/octet-stream" I'm not sure on which one gives here.
for .mp4 files type ".mp4" as the extension and "video/mp4" as the mime type (this one I tested personally)
Select "OK",
type services.msc, find the "World Wide Web Publishing Service" and click on the restart icon on top or open up and choose restart
Temp converter
jQuery:
$('input').change(function() { var temp = $(this).val(); var type = $(this).attr('id'); if(type == 'far') { var convt = (5/9)*(temp-32); $('#cel').val(convt); } else { var convt = (9/5)*temp+32; $('#far').val(convt); } });
JSFIDDLE
Randomize list <li> with javascript
I haven't implemented this yet. I just wanted to put it up here so I don't forget. Plus, all credit(or blame if it doesn't work :) ) to this Daniel Martin:
//shuffles list in-place function shuffle(list) { var i, j, t; for (i = 1; i < list.length; i++) { j = Math.floor(Math.random()*(1+i)); // choose j in [0..i] if (j != i) { t = list[i]; // swap list[i] and list[j] list[i] = list[j]; list[j] = t; } } }
edit...I implemented it Boom:
//shuffles list in-place function shuffle(list) { var i, j, t; for (i = 1; i < list.length; i++) { j = Math.floor(Math.random()*(1+i)); // choose j in [0..i] if (j != i) { t = list[i]; // swap list[i] and list[j] list[i] = list[j]; list[j] = t; } } } var list = $('#dalist').children(); shuffle(list); $('#dalist').html(list);
jquery script to disable/enable select/deselect radio buttons
j$(document).ready(function() { j$('#level_standardcompact1861').attr('disabled','disabled'); j$('#promotional_benefit_dropdown').change(function(){ var selection = j$(this).val(); if(selection == 8 ){ j$('#level_standardcompact1861').removeAttr('disabled').attr('checked',true); j$('#level_standardcompact1865').attr('checked',false).attr('disabled','disabled'); } else { j$('#level_standardcompact1861').attr('checked',false).attr('disabled','disabled'); j$('#level_standardcompact1865').removeAttr('disabled').attr('checked',true); } }); });
return php array from function
function theFunction($r){ $speakers = array(); $i = 10; while($r < $i){ $speakers[] = $r; $r++; } return $speakers; } $speakers = theFunction(4); print_r($speakers);
Returns:
Array ( [0] => 4 [1] => 5 [2] => 6 [3] => 7 [4] => 8 [5] => 9 )
Build php array with foreach loop
$sql = 'getAllWebinarResources'; $res = $DBH->getAll($sql); $list = array(); foreach($res as $r){ $list[$r['id']]['name'] = $r['title']; $list[$r['id']]['url'] = $r['url']; }
SQL Convert to fix my field type
I created a stored procedure to get all the sessions for an upcoming meeting. I needed to sort the sessions according to day, start time, end time, and then by the sessions number. The session 'number' field in our DB is set as VARCHAR so when sorted it is done alphabetically. So: 1, 4, 8, 9, 11, 12, 14 is sorted as: 1, 11, 12, 14, 4, 8, 9. This would be fixed if the 'number' field was set as INT in the table but unfortunately that isn't the case. To fix the problem I used CAST which changes the field to the type I CAST it to. So, the bottom of my stored procedure looked like this: ORDER BY event_date, start_time, end_time, CONVERT(INT, number)
IE form with one input
If you have form with only one input, and I don't believe you count 'hidden' inputs, and hit the 'Enter' key, IE will just re-load the page.
http://www.rachaelarnold.com/dev/archive/enter-key-form-submission-bug