jQuery: firing a click event from a class instead of an ID
0 views
Skip to first unread message
hofar...@houseoffusion.com
unread,
Mar 20, 2015, 12:13:18 PM3/20/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ColdFusion Technical Talk
I have a button on a page with a class attached to it (several buttons
actually) shouldn't I be able to attach a jQuery click event to the buttons
using a class as a selector:
$(".editPathway").click(function(){
var x = $(this).data("id");
$('#pathEditFrm').jqm({
modal:true,
ajax:'index.cfm?action=loadPathEdit&id=' + x + '&nolayout',
closeOnEsc: true
}).jqmShow();
});
a variation on this code fires just fine from an ID selector.. but won't
fire at all from a class.
Thanks in advance
--
--
Scott Stewart
Adobe Certified Instructor, ColdFusion 8 & 9
Adobe Certified Expert, ColdFusion 8 & 9
var x = $(this).data("id");
$('#pathEditFrm').jqm({
modal:true,
ajax:'index.cfm?action=loadPathEdit&id=' + x + '&nolayout',
closeOnEsc: true
}).jqmShow();
});
#pathList is the parent container and the form is injected in via $.load()
(there's a data form above it, I want to reload the bottom each time a new
record is added)
On Fri, Mar 20, 2015 at 12:17 PM, Robert Harrison <rhar...@aimg.com>
wrote:
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ColdFusion Technical Talk
.on() in jquery 1.7+ is probably what to use instead of delegate(). I only
say this as the documentation notates on() supercedes delegate(). And they
have a habit of deprecation in these instances.
$(document).on(event, selector, function )
On Mar 20, 2015 1:08 PM, "Scott Stewart" <webm...@sstwebworks.com> wrote:
>
>
> .delegate is what I was looking for
>
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ColdFusion Technical Talk
Byron,
delegate is not depreciated in 1.7, it's still active as of 1.11, which is
the version that I'm using. There are a couple of instances of deferred.is that are depreciated but not .delegate.