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]
- JSON parsing error syntax error unexpected end of input
- How do I link a JavaScript file to a HTML file?
- Pass request headers in a jQuery AJAX GET call
- jQuery Ajax error handling, show custom exception messages
- How to send multiple data fields via Ajax?
- My javascript is returning this error: $.ajax is not a function
- JavaScript runtime error: ‘$’ is undefined
- Set timeout for ajax (jQuery)
- 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 TypeError: $.POST is not a function
- Set selected option of select box
- TypeError: $.ajax(…) is not a function?
- XML Parsing Error: not well-formed in FireFox but good in Chrome
- Click button copy to clipboard
- Ajax Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource
- How to make html table vertically scrollable
- How to fix the ‘Missing required request header. Must specify one of: origin,x-requested-with’ Ajax Error
- What’s the point of the X-Requested-With header?
- How to make a simple image upload using Javascript/HTML
- How to make Bootstrap carousel slider use mobile left/right swipe
- How to Show External website inside another page without iFrame? [closed]
- bootstrap 3 navbar collapse button not working
- Display XML content in HTML page
- Bootstrap carousel not sliding
- Play/pause HTML 5 video using JQuery
- Refresh/reload the content in Div using jquery/ajax
- jQueryUI dialog width
- How to get a cross-origin resource sharing (CORS) post request working
- jQuery Form Validation before Ajax submit
- jQuery – Illegal invocation
- Clear form fields with jQuery
- How to call a webservice method from an html page [javascript] with out refresh the page
- Javascript – ERR_CONTENT_LENGTH_MISMATCH
- Random background images CSS3
- FormData append not working
- $(document).ready(function() is not working
- JQuery: ‘Uncaught TypeError: Illegal invocation’ at ajax request – several elements
- jquery ajax function not working
- Show div #id on click with jQuery
- How do I remove a box-shadow effect from an element when another element is hovered?
- Slide right to left?
- jQuery ajax error function
- How to manage ajax calls and JSON in wordpress
- ajax stopped working when not logged in?
- Getting click on item to open closest relevant element (popup) with jQuery
- How can publish my bootstrap created table ( huge amount of data) on my word-press theme?
- jQuery for Fade Preload Causes My Site Favicon to Disappear from Tab of Browser
- Orderby post__in Not Working Correctly?
- Get ajaxForm response value
- how to allow download after newsletter subscription?
- jQuery function not working in WordPress but works in jsfiddle
- wordpress ajax upload media not working
- How to pull data from a table using wpdb?
- Reload selected post in multiple post query with ajax
- Site images are fixed in front of my site content [closed]
- Is not using admin-ajax to ajax submissions okay?
- How can I add a new lib path without call each one on the header?
- Automatic add space if user enters number(any digit)
- jQuery.post() calling function with parameter
- $_POST empty in using new php file added to theme
- Autocomplete for titles via ajax – rework of past post away from like_escape()
- Passing variable data from external jQuery file to options.php
- Pass the updated value of aid from form using ajax
- How to specify url for ajax call in wordpress plugin
- Retrieve customizer value using ajax or customizer api and print the value in theme
- Possibility of creating a folder in the wordpress root install and installing a file there, all via plugin?
- Displaying contents of a tab
- owl carousel not working after ajax load [duplicate]
- WordPress version for this autocomplete jQuery code
- Call admin ajax using absolute url? Relative URL breaks (frontend ajax)
- Load more button
- Ajax Request with jQuery not happening
- Ajax autocomplete based on usercode
- Variable not being returned from Ajax Javascript (though javascript receives it)
- Page keeps refreshing with Ajax form
- jQuery AJAX add json2 dependency?
- How to respond with WP_Ajax_Response();
- How to pass more information though separate post keys via AJAX
- wp_signon not working fine and 302 moved temporarily?
- Loop not appending through infinite-scroll ajax call
- Convert WordPress SACK code to new admin-ajax
- Get selected value with PHP and jQuery
- 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
- Ajax Query returns zero
- 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?
- Load Meta box value into div AJAX [duplicate]
- 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
- How to combine jQuery in-place editor with $wpdb->update
- Load loop images on click / defer image loading until click or other event
- Widget won’t work due to old JavaScript? Any ideas how to make it work? [closed]
- can’t make jQuery work (change image on time interval) [closed]