[Solved] Codeigniter JQUERY |
On my codeigniter project, the user can insert a image by url or upload it per normal.
I generate some text using jquery html() Code: <script type="text/javascript"> When I click on a.url_input link it generates new html in that html it has a cancel a tag in it When I click on the cancel tag it should re generate the (standardhtml) but does not it is not detecting the a.cancel link Code: $('.hyperlink_text').html(standardhtml); Example Codepen Demo Question How can I make sure when I click on cancel button on the newhtml it will regenerate the standardhtml
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
That's because the a.cancel class doesn't exit yet when the page is generated, but only later on. In that case, you will have to 'bind' the click function to the new element.
You can try this: Code: $( "a.cancel" ).on( "click", function() {
(11-20-2016, 12:51 AM)Wouter60 Wrote: That's because the a.cancel class doesn't exit yet when the page is generated, but only later on. In that case, you will have to 'bind' the click function to the new element. Not working I tried adding it inside Code: $(".hyperlink_text a.url_input").click(function(){ This part it work sort of but was un able to click on #url_input again it only let me do it once.
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
Code: $( "#an_item_that_exist_on_start" ).on( "click", "a.url_input", function() {
Working now
Code: <script type="text/javascript">
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
|
Welcome Guest, Not a member yet? Register Sign In |