Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-28-2010, 10:20 AM   PM User | #1
janmartin
New to the CF scene

 
Join Date: Nov 2009
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
janmartin is an unknown quantity at this point
How to start a jquery function on an object?

Hi,

I need to make this static jquery code totally dynamic.
Question is, how to start the abc function on the newimage object?

The Problem is this line:
$(newimg).abc({

OLD static, working:
Code:
<img src="001.jpg" class="dosomething" />

$(document).ready(function(){
	$("img.dosomething").abc({
                option1: A,
		option2: B
         });
});
NEW dynamic:
(values hard-coded for testing only)
Code:
$(document).ready(function(){
	var newimg= document.createElement('img');
	newimg.src = "001.jpg";
	newimg.setAttribute('class', 'dosomething');

	$(newimg).abc({
                option1: A,
		option2: B
         });
});
janmartin is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:44 AM.


Advertisement
Log in to turn off these ads.