views:

144

answers:

1

I'm using the jquery taconite plugin to make an ajax request that will replace a certain element in my page, however the element has an id like "email.subject"..

I can select it just fine if I do '$("email\\.subject")', but when I try to use the taconite plugin like this:

<taconite>
    <replaceWith select="#email\\.subject">
        JUCA
    </replaceWith>
</taconite>

The plugin log says:

[taconite] No matching targets for selector: #email\\.subject

How can I make this work?

A: 

Ok this is what i did. It is not working for me though. (I did not go through the entire source). But it will point you in the right direction.

The problem really is that in the jquery.taconite.js file, around line 152 (if you are looking at the latest version!) you can see:

var q = cmdNode.getAttribute('select');
var jq = $(q);

if i add an alert to the above statement to find out the value of jq it says: [Object object]. But this works as long as it contains no .

The problem is that the author of taconite is not checking for . from the "select" attributes value. The following code works for me when i tried it isolated in a simple js file. But when i use the same in the jquery.taconite.js file it does not work. Needs more tweaking around?

var x = cmdNode.getAttribute('select');
alert(x); //Shows what you have entered in <replaceWith select="#email.subject"> i.e "#email.subject"
var q = x.replace(/\./g, "\\\\\."); //Searches for a . in the string and escapes it! So now it becomes: "#email\\.subject"
alert(q) //Alerts #email\\.subject ... Great! Works fine till this point!
var jq = $(q);
alert(jq[0]); //Says "undefined"!!!! This is where i got stuck! Why does it say undefined??
Shripad K