{"id":1134,"date":"2012-09-11T21:13:22","date_gmt":"2012-09-11T21:13:22","guid":{"rendered":"https:\/\/theextremewebdesigns.com\/blog\/?p=1134"},"modified":"2012-09-11T21:13:22","modified_gmt":"2012-09-11T21:13:22","slug":"alert-textbox-value-using-jquery","status":"publish","type":"post","link":"https:\/\/theextremewebdesigns.com\/blog\/alert-textbox-value-using-jquery\/","title":{"rendered":"Examples On Using jQuery to Alert Textbox Value"},"content":{"rendered":"<p>Have you been caught up trying to figure out how to alert textbox value using jQuery? In this article, I am going to share with you \u00a0a very simple &amp; easy way to use <em><strong>jquery to alert textbox value<\/strong><\/em> by using just single line of code. Follow along for more info.<\/p>\n<p><!--more--><\/p>\n<h2>Examples to Alert Textbox Value using jQuery<\/h2>\n<div class=\"make_demo\">\r\n\r\n\t<form action=\"https:\/\/theextremewebdesigns.com\/blog\/wp-content\/themes\/ewd_blog_2017\/try_demo.php?post_id=1134\" method=\"post\" name=\"form1\" target=\"_blank\" id=\"form1\">\r\n\r\n\r\n\t<input type=\"hidden\" name=\"shortcode_content\" id=\"shortcode_content\" value=\"\" \/>\r\n\r\n        <div class=\"try_demo_btn_container\">\r\n\r\n\r\n            <button type=\"submit\" name=\"sbt_make_demo\" id=\"sbt_make_demo\" class=\"btn-primary btn-try-demo\">\r\n                Try Demo\r\n            <\/button>\r\n\r\n\r\n        <\/div><!-- .try_demo_btn_container -->\r\n\r\n    <\/form>\r\n    <\/div>\r\n    \n<p>Let\u2019s assume that you have a textbox with ID \u201cname\u201d. You can <strong>alert textbox value using jQuery<\/strong> in the following way:<\/p>\n<pre class=\"lang:js decode:true\">&lt;script type=\"text\/javascript\"&gt;\n$(document).ready(function() {\n\nvar value = $(\"#name\").val();\n\nalert(value);\n\n});\n\n&lt;\/script&gt;<\/pre>\n<p>When you save the above code &amp; view the page in your browser, you will notice an alert that gives the value of the textbox. If you would rather alert the textbox value when a button with ID &#8220;my_button&#8221; is clicked, you may use the code below:<\/p>\n<pre class=\"lang:js decode:true\">$('#my_button').click(function() {\n\nvar value = $(\"#name\").val();\n\nalert(value);\n\n});<\/pre>\n<p>If you have a class of &#8220;my_button_class&#8221; applied to a button &amp; you want to alert textbox value when this button is clicked, you can use the following code:<\/p>\n<pre class=\"lang:js decode:true\">$('.my_button_class').click(function() {\n\nvar value = $(\"#name\").val();\n\nalert(value);\n\n});<\/pre>\n<p>When you use the above code, just make sure that you use the proper ID &amp; Class in your own code in order for the code to work properly. So that&#8217;s one fine way to use <strong>jQuery to alert the textbox value<\/strong>. You can apply the same tip to alert textarea value.<\/p>\n<div class=\"make_demo\">\r\n\r\n\t<form action=\"https:\/\/theextremewebdesigns.com\/blog\/wp-content\/themes\/ewd_blog_2017\/try_demo.php?post_id=1134\" method=\"post\" name=\"form1\" target=\"_blank\" id=\"form1\">\r\n\r\n\r\n\t<input type=\"hidden\" name=\"shortcode_content\" id=\"shortcode_content\" value=\"\" \/>\r\n\r\n        <div class=\"try_demo_btn_container\">\r\n\r\n\r\n            <button type=\"submit\" name=\"sbt_make_demo\" id=\"sbt_make_demo\" class=\"btn-primary btn-try-demo\">\r\n                Try Demo\r\n            <\/button>\r\n\r\n\r\n        <\/div><!-- .try_demo_btn_container -->\r\n\r\n    <\/form>\r\n    <\/div>\r\n    \n<h5>Simple, isn&#8217;t it?<\/h5>\n<p>Do you know of other ways to <em><strong>alert textbox value using jQuery<\/strong><\/em>? Please feel free to share by commenting below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Have you been caught up trying to figure out how to alert textbox value using jQuery? In this article, I am going to share with you \u00a0a very simple &amp; easy way to use jquery to alert textbox value by using just single line of code. Follow along for more info.<\/p>\n","protected":false},"author":1,"featured_media":395,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[20,13],"tags":[117,118,42,41],"class_list":["post-1134","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-jquery-tips-and-tricks","category-tips-and-tricks","tag-jquery-alert","tag-jquery-alert-textbox","tag-jquery-demos-2","tag-jquery-tips"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/paBnQX-ii","jetpack_sharing_enabled":true,"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/posts\/1134","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/comments?post=1134"}],"version-history":[{"count":0,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/posts\/1134\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/media?parent=1134"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/categories?post=1134"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/tags?post=1134"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}