Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multiple editable texts with an id #18

Closed
farukuzun opened this issue Nov 28, 2012 · 2 comments
Closed

multiple editable texts with an id #18

farukuzun opened this issue Nov 28, 2012 · 2 comments
Labels

Comments

@farukuzun
Copy link

Is it possible to show multiple editable texts with using only one id. for example;

<a href="#" id="test" data-type="text" data-pk="2" >asd</a><br>

<a href="#" id="test" data-type="text" data-pk="3" >dfg</a><br>

<a href="#" id="test" data-type="text" data-pk="4" >ghj</a>

I want to make editable all lines that above with the code that below.

<script>
$(function(){
 $('#test').editable({
   url: '/post',
   title: 'Enter username'
  });
});
</script>

With the codes that above, only the first line became editable.

@vitalets
Copy link
Owner

using the same idbreakes html standarts, it should be unique on the page.
Instead use css class and data-name attribute:

<div id="mydiv">

<a href="#" data-name="test" data-type="text" data-pk="2" >asd</a><br>

<a href="#" data-name="test" data-type="text" data-pk="3" >dfg</a><br>

<a href="#" data-name="test" data-type="text" data-pk="4" >ghj</a>

</div>

$('#mydiv a').editable({
   url: '/post',
   title: 'Enter username'
  });

@farukuzun
Copy link
Author

Solved. Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants