PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Hi all,
I'm having the problem while using the edit-in-place scripts (http://24ways.org/2005/edit-in-place-with-ajax) from internet. It's ok when i just used for one text id, but after i added a while loop because of multiple items and it become only the 1st text id content works. So below here i post a piece of my code, hope any here can help on this. How to do the multiple items with the same id? Please help. Thank you very much.
PHPyoungster wrote:IDs are meant to be a one-time occurance.
then how to make it able to occur for everytime in the while loop? Can it be done? this is because i had tried the code that inside the comments of the page above it changed the scripts inside function init(), and it didn't work for my case.
hi Chris Corbyn,
thanks for help. But it can't work. Should I modify anything inside the js file?
here is i tried to modify the function inside the editinplace.js, which i refer to the comments that below the page as i stated before in this post. But it can't work to me also.
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:4. All users of any level are restricted to bumping (as defined here) any given thread within twenty-four (24) hours of its last post. Non-trivial posts are not considered bumping. A bump post found in violation will be deleted, and you may or may not receive a warning. Persons bumping excessively be considered as spammers and dealt with accordingly.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
kiko wrote:Hi, does any know how to slove this problem? Thanks.
As everyone else has already stated, it is not possible to "target" multiple items with the same ID. The dom only will recognize one, this is the whole purpose of IDS, to be unique.
Classes are made to not be unique. Have a look at them, if you are using a JavaScript framework it is pretty simple to select all of the same classes.
thanks, Zoxive. Actually I had just solved this problem but now it will appear the error on page icon at the bottom left of my page. You know about this Zoxive? I modified as the below code. Thank you.
function init(){
var max=50;
for(i=0; i<max ;i++){
[b]makeEditable('desc'+i);[/b] //if I put semicolon in the end of i, then I'll not get the error but I'll not get what I need.
}
}