LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-28-2013, 05:32 AM   #1
cin_
Member
 
Registered: Dec 2010
Posts: 281

Rep: Reputation: 24
Javascript :: Alliteration Text Box


I am trying to make a text box on a webUI force the user to use alliteration. I know how have the user input text and check it to see if it follows the rules of alliteration, but how could I be constantly checking the user's input?

As the person types I determine if the last character was a space, if so then the next character must be the same as the first from the previous word, if they type that letter then proceed, if not then leave blank.

Can I run active dynamic Javascript like this?

Last edited by cin_; 05-30-2013 at 01:23 AM. Reason: gramm`err
 
Old 05-28-2013, 09:20 AM   #2
vmccord
Member
 
Registered: Jun 2012
Location: Topeka, KS
Distribution: Mostly AWS
Posts: 71
Blog Entries: 31

Rep: Reputation: Disabled
Yes, you could do this via Javascript. I'd also look into jquery. JQuery would be easier to implement. I think the thing to remember is to evaluate the value at input. If you Google "validate, textbox, and jQuery" you'll get a ton of examples. I liked this one specifically because it is at input rather than at form submit.

http://stackoverflow.com/questions/1...nt-has-changed
 
Old 05-30-2013, 01:29 AM   #3
cin_
Member
 
Registered: Dec 2010
Posts: 281

Original Poster
Rep: Reputation: 24
Figured

vmccord, thanks for the reply. This led me on to what I was looking for.

Code:
<html>

<script type="text/javascript">

$(document).ready(function() {

    $('textarea.tecksd').on('keyup change', function() {
        $('p.dispd').text('your text: ' + $(this).val());
    });	
});

</script>

<body>
<textarea class="tecksd" placeholder="begin typing here..." id="my_text"></textarea>

<p class="dispd">your text: </p>

</body>
</html>

Last edited by cin_; 05-30-2013 at 01:32 AM. Reason: gramm`err
 
  


Reply

Tags
html, html5, javascript



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Javascript to display multiple text box ohcarol Programming 6 04-01-2013 10:52 AM
[SOLVED] JavaScript - input box czezz Programming 4 07-26-2011 06:33 PM
[SOLVED] javascript fancy a box? trscookie Programming 3 02-23-2010 09:07 PM
Grabbing text from a text box in a window running in wine. thefalling881 Programming 6 07-21-2008 08:38 PM
Bug A Javascript that will not allowed alphabet character type into a text box Linh Programming 2 09-22-2003 11:15 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:39 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration