Bug Tracker

Modify

Ticket #11833 (closed enhancement: invalid)

Opened 23 months ago

Last modified 23 months ago

Can't assign a function to a specific element using jQuery

Reported by: jquery@… Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.2
Keywords: Cc:
Blocking: Blocked by:

Description

This works in regular javascript:

var mdiv = document.getElementById("mydiv"); mdiv.myUpdateUI = function () {

alert('works'); Code to update div here

}

This doesn't do anything when I try: $("#mydiv).myUpdateUI = function () {

alert('doesn't work'); Code to update div here

}

While I understand there is a $.fn ability, the "myUpdateUI()" method would only ever apply to that one object, so putting it in ALL of jQuery seems wrong.

I searched before posting, but didn't find anything. Thanks for your time. jQuery is great BTW.

Change History

comment:1 Changed 23 months ago by dmethvin

  • Status changed from new to closed
  • Resolution set to invalid

Please ask for help on the forum, not the bug tracker.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.