- Screen name: cgtrman
cgtrman's Profile
4 Posts
4 Responses
0
Followers
Show:
- Expanded view
- List view
Private Message
- 21-Mar-2014 04:27 PM
- Forum: Using jQuery
How can this be converted from .live() to .on()?
$('[id^=generic1_id_]', '[id^=generic2_id_]').live('click', function(){
To convert to .on(), I could create two working examples seen below, but then I have to re-use code in both, whereas with the .live() example, I am able to reference both selectors and the code will be executed on a click event for either selector. Also, I am using .live() because the click handler needs to apply to new elements added/created after the DOM is loaded. I know the .on() examples below will work for existing and new elements, but I must separate them because I can't figure out how to write the code where it will apply to both selectors while using the .on() syntax.
// Generic Example - Click handler for elements with an IDs beginning with "generic1_id_" $(document).on('click', '[id^=generic1_id_]', function(){ }
AND
// Generic Example - Click handler for elements with an IDs beginning with "generic2_id_" $(document).on('click', '[id^=generic2_id_]', function(){ }
I have tried this but it is not correct because the '[id^=generic2_id_]' will be interpreted as data not as a 2nd selector.
// Won't work $(document).on('click', '[id^=generic1_id_]', '[id^=generic2_id_]', function(){
There is surprisingly little I can find in searches to find anything beyond simple examples of converting .live() to .on(). Any ideas?
- 13-Dec-2013 03:04 PM
- Forum: Using jQuery Plugins
I am using the jQuery media plugin (http://jquery.malsup.com/media/) along with the ElementIT Flash Uploader (http://www.element-it.com/multiple-file-upload/flash-uploader.aspx). I am using an old version of the uploader (v 1.7) but everything has been working great, until I updated the jQuery media plugin to the latest version.Once the media plugin embeds the flash object, it is missing the ID attribute.- $("#flashloader").media({
- width: 350,
- height: 210,
- autoplay: true,
- src: 'includes/ElementITMultiPowUpload1.7.swf',
- attrs: { id: 'FlashFileUpload' }, // object/embed attrs
- params: { bgColor: '#ffffff', Quality: 'High', AllowScriptAccess: 'Always', SeamlessTabbing: '1', wmode: 'transparent' }, // object params/embed attrs
- flashvars: { uploadUrl: '<?php echo htmlentities($_SERVER['PHP_SELF']); ?>',
- redirectUploadUrl: 'files.php',
- labelUploadVisible: 'No',
- uploadButtonVisible: 'No',
- backgroundColor: '#FFFFFF',
- listTextSelectedColor: '#000000',
- listBackgroundColor: '#FFFFFF',
- listSelectionColor: '#DFE7F2',
- listUploadedColor: '#DFE7F2',
- listRollOverColor: '#ffffcc',
- useExternalInterface: 'yes',
- filesListX: '2',
- filesListY: '30',
- progressBarX: '7',
- progressBarY: '155',
- labelInfoX: '7',
- labelInfoY: '160' },
- caption: false // supress caption text
- });
Here is the object it creates (missing the ID attribute)- <object width="350" height="210" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" data="https://localhost/ssp/includes/ElementITMultiPowUpload1.7.swf" codebase="https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7" type="application/x-shockwave-flash">
Here is some additional HTML:- <!DOCTYPE HTML>
- <html>
- <head>
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge" />
Since I specifying an ID, I'm not sure it is not making it as an attribute for the object element.- attrs: { id: 'FlashFileUpload' }, // object/embed attrs
Any recommendations?
I am wanting to add the ScrollTo functionality in JQuery that produces an
animated back to top of page. What is the best plugin to use for this? I
want to mimick the traditional 'Back to Top' link that appears at the bottom
of long pages.
--
View this message in context: http://www.nabble.com/ScrollTo-Functionality-tf2391291.html#a6666866
Sent from the JQuery mailing list archive at Nabble.com.
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/
I have successfully sent data to the server via AJAX using:
$.ajax({ type: "POST", url: "handler.php", data: "comments=" + comment_value
+ "&id=" + userid, success: comment_success(userid) });
So I am able to update my db. However, once the db has been updated, how do
I refresh the data on the page (w/o a page refresh) using AJAX? Any feedback
will be appreciated.
--
View this message in context: http://www.nabble.com/AJAX-Newbie-Question-tf2319723.html#a6453905
Sent from the JQuery mailing list archive at Nabble.com.
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/- «Prev
- Next »
Moderate user : cgtrman
© 2013 jQuery Foundation
Sponsored by and others.

