How to use <button type=button> - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: How to use <button type=button> (/showthread.php?tid=41955) Pages:
1
2
|
How to use <button type=button> - El Forum - 05-21-2011 [eluser]Wondering Coder[/eluser] Hi to all, I'm usually Using input type submit eg: <input type="submit" name="assign" value="Assign"/> and using this is no problem for me but now I want to use button eg:<button type="button" class="button" id="deleteb"><div><b>Assign Student</b></div></button> but don't know how to used it or call it to my controller. this is my controller function Code: function group_students() How to use <button type=button> - El Forum - 05-22-2011 [eluser]theprodigy[/eluser] What do you want the button to do? A button is just a button unless you have a handler listening for it's click event. You'll have to either add a onclick attribute to it, or handle it in javascript. How to use <button type=button> - El Forum - 05-22-2011 [eluser]Wondering Coder[/eluser] thanks for the rep theprodigy, either the two is good. could you give me an example on how to do this. i'm pretty new to javascript scripting. How to use <button type=button> - El Forum - 05-22-2011 [eluser]theprodigy[/eluser] It all depends on what you want the button to do. A simple script would be: Code: [removed] But that's not very useful in production environment. What do you want your button to do? How to use <button type=button> - El Forum - 05-22-2011 [eluser]Wondering Coder[/eluser] why do you say that? You mean I will a future problem if i used buttons? How to use <button type=button> - El Forum - 05-22-2011 [eluser]theprodigy[/eluser] no, I'm saying having a function that alerts the id of the element (like my example) isn't useful in production environment. How to use <button type=button> - El Forum - 05-22-2011 [eluser]Wondering Coder[/eluser] ah, i don't think I'll be using an alert or something. What I just want is my button to direct it in my controller. How to use <button type=button> - El Forum - 05-22-2011 [eluser]theprodigy[/eluser] Quote:What I just want is my button to direct it in my controller.What exactly do you mean by that? Like doing an ajax call? Submitting a form? What do you mean by 'direct it in my controller'? How to use <button type=button> - El Forum - 05-22-2011 [eluser]InsiteFX[/eluser] html5 way: You will need to play with it. Code: // css code InsitweFX How to use <button type=button> - El Forum - 05-22-2011 [eluser]Wondering Coder[/eluser] ok, sorry for not pointing, hehe. yes. when i clicked the button it will submit the form using button type. |