Your button was added dynamically. So you can not bind event in simple way.
As button is added after DOM is fully ready.
You need to bind it with the refrence of document
or body
jQuery(document).on('click', '#readmore', function(e){
e.preventDefault();
alert("you clicked the button");
jQuery("#bodytext").css("display", "block");
});
Read more about it here
Related Posts:
- Contact Form 7 – Submit Form not working After Ajax Request [closed]
- Pass request headers in a jQuery AJAX GET call
- How to send multiple data fields via Ajax?
- JavaScript runtime error: ‘$’ is undefined
- JavaScript Loading Screen while page loads
- Jquery Ajax Posting JSON to webservice
- Force a default browser on my android phone using a simple html shortcut page
- Ajax Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource
- How to make html table vertically scrollable
- How to Show External website inside another page without iFrame? [closed]
- Bootstrap carousel not sliding
- JQuery: ‘Uncaught TypeError: Illegal invocation’ at ajax request – several elements
- jquery ajax function not working
- How do I remove a box-shadow effect from an element when another element is hovered?
- Slide right to left?
- How to manage ajax calls and JSON in wordpress
- How to add a ” waiting” icon for an ajax in WP frontend?
- Can’t get a JSON object in response to an Ajax request with wp_ajax
- What is the simplest ajax upload plugin or script to be used with wordpress?
- WordPress Ajax URL for function in functions.php
- AJAX function returning -1
- call shortcode in javascript
- WP set auth cookie using Ajax is not saved to browser
- ajax live search for post title
- WordPress Ajax always returns a 404 error
- jQuery AJAX form validation
- Proper way to load a single post via Ajax?
- Trying to get single posts to load on the front page via ajax
- ajax call in wordpress front end
- Ajax not firing properly using Firefox, but works in Chrome
- jQuery Ajax() doesn’t work when the page is accessed as a WordPress template page
- How to load whole WordPress pages dynamically with AJAX/jQuery like this following website?
- WP REST return value to error function from Request
- Creating custom AJAX requests
- How to pass jQuery ajax URL value
- how to get the comment ID in the front end when the REPLY button is clicked?
- Admin wp_ajax hook returning 0
- WordPress Ajax not function as I expect… what’s wrong?
- wp_verify_nonce not working
- Tags in WordPress 3.2
- php ajax problem – weird 301 responses!
- WordPress customizer refresh screen after save
- Loading posts via AJAX in a hidden div with updated URL?
- How to get a value from PHP in Jquery through Ajax
- Not sure why wp_ajax isn’t working?
- Load created php file data via ajax
- jQuery Ajax returning correct Response, but after redirect to 404 Error
- WordPress Ajax problem with undefined url
- Correct way to write jQuery functions in WordPress
- Intergrating agile carousel to wordpress: how to write the ajax_callback function
- Scripts not appending to element in AJAX call – why?
- AJAX Loaded Glossary like Search results with links to other entries from custom table
- How to Dynamically Load Content Into Body of Bootstrap Modal Window?
- Return an array from get_terms and store as JavaScript array for search autocomplete
- Frontend Post with JQuery AJAX to Php Issue
- Trouble with WordPress Ajax Login System – 302
- WP http XML response HTML encoding and image display problems
- Using WP_Query to grab custom meta values, foreach to json object
- Add/remove action on jQuery toggle
- delete post meta by AJAX
- url – ajax loaded but no JS
- Ajax form submit not working, returns 0
- echo custom fields with AJAX
- Creating a new div onclick wordpress+ajax
- how to json_encode(); the Loop content so that the encoded array is [“0”:content, “1”:content]
- Properly embed javascript into WP (using function.php) – doesn’t work?
- jQuery tabs plugin with callback to fetch data
- How to keep HTML form field that is conditional hidden with javasript hidden after page reload?
- No Object Properties sending form through AJAX
- Redirect wp_dropdown_pages() to an AJax request?
- Custom AJAX form not working async
- how to use wp_editor() here am getting empty result
- Manipulate retrieved ajax data in php
- problems with jquery external rss feed integration
- Converting a working AJAX form to work with WordPress
- WordPress Front-End Theme Editor
- AJAX calendar navigation returns -1
- How to use JQuery Marquee in WordPress?
- jQuery for Fade Preload Causes My Site Favicon to Disappear from Tab of Browser
- Get ajaxForm response value
- How to pull data from a table using wpdb?
- Reload selected post in multiple post query with ajax
- Is not using admin-ajax to ajax submissions okay?
- How can I add a new lib path without call each one on the header?
- Autocomplete for titles via ajax – rework of past post away from like_escape()
- How to specify url for ajax call in wordpress plugin
- Call admin ajax using absolute url? Relative URL breaks (frontend ajax)
- Ajax Request with jQuery not happening
- Page keeps refreshing with Ajax form
- wp_signon not working fine and 302 moved temporarily?
- change the icon of a custom post type in WordPress to use twitter boostrap
- how to refresh index page without reloading browser using ajax
- Ajax request with jQuery without WP_ajax
- jQuery form plugin, submit in the wordpress way
- Contact Form 7 submission does not complete [closed]
- Using WP Ajax and jQuery to process multiple forms on the same page?
- Combo box populating a DIV using ajax/jquery
- Dynamically populate Cascading Dropdown from MySQL using JQuery/AJAX [closed]
- Infinite Scroll applied to ajax loaded content
- can’t make jQuery work (change image on time interval) [closed]