[ask] how to create link that can disable another link? |
[eluser]dinnar[/eluser]
hi guys, i need your help how to create link that can disable another link? e.g: i have 3 links: link_a, link_b, link_c if i click link_c, link_a and link_b become disable.... how to do that?
[eluser]ayukawaa[/eluser]
There could be better ways, but this should work using unobtrusive JavaScript with jquery: Code: <html> Notice that I do not touch the links. The first link toggle the class to the other links. When click on the other links if it hass the disabled class, stop. ^_^
[eluser]web-johnny[/eluser]
You can simply try the code of ayukawaa in a view . For example to the controller (application/controllers) you can do this Code: if ( ! defined('BASEPATH')) exit('No direct script access allowed');
[eluser]mihaibaboi[/eluser]
[quote author="dinnar" date="1305177780"]how to do it in codeigniter???[/quote] It doesn't matter if your'e using CodeIgniter or not. The script is inline so you can just put it in your view. Just treat your view as you normally would a php/html file.
[eluser]dinnar[/eluser]
i want to make 3 link like: link_a link_b link_c usually i create link in controller like this: $data['link'] = array('link_add'=>anchor('somefile/add/', 'link_a', array('class' => 'add')), anchor('somefile/delete/', 'link_b', array('class' => 'delete')), anchor('somefile/disable_another_link/', 'link_c', array('class' => '?'))); what should i fill in class link_c ??? i hope when i click link_c, link_a and link_b become disable
[eluser]mihaibaboi[/eluser]
I'm not sure I understand your problem. The code that @ayukawaa provided is non-intrusive. You don't need to do anything to the links, other that provide the id's specified in te snippet. All other attributes are up to you, as they do not affect the jQuery script. |
Welcome Guest, Not a member yet? Register Sign In |