Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6613863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:16:08+00:00 2026-05-25T20:16:08+00:00

HTML: <div class=mydiv> My Div <ul> <li><input type=submit value=first/></li> <li><input type=submit value=second (blah blah)/></li>

  • 0

HTML:

<div class="mydiv">
    My Div
    <ul>
       <li><input type="submit" value="first"/></li>
       <li><input type="submit" value="second (blah blah)"/></li>
       <li><input type="submit" value="third . blah blah"/></li>
    </ul>
</div>

How can I retrieve the value of the input and replace any ‘(‘ or ‘.’ with a ‘\n’? The result would appear like:

second
(blah blah)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T20:16:09+00:00Added an answer on May 25, 2026 at 8:16 pm

    Wrote this assuming you wanted to keep the separator as your exemple implied, you can see it working here.

    $(document).ready(function(){
      $('.mydiv input[type=submit]').each(function() {
        $this = $(this);
        $this.val($this.val().replace(/(\.|\()/, '\n$1'));
      });
    });
    

    EDIT: @vzwick: regarding your edit no, it shouldn’t be a one-liner, I’m caching $this on purpose.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My HTML is something like this <div id=mydiv class=common> <input type=text id=text1 value= />
How can I retrieve only the first class p7 from this HTML element? HTML
I have a HTML structure: <div class=mydiv>xx <span>test1</span> <span>test2</span> <div class=inerdiv> <span>inner span</span> </div>
how can I insert some HTML code between <div id=mydiv>...</div> using javascript? Ex: <div
I have the following HTML: <div id=mydiv> <div class=myclass></div> </div> I want to be
I have this code: <div id=star-rating> <script type=text/javascript> $(function(){ $('#star-rating form').submit(function(){ $('.test',this).html(''); $('input',this).each(function(){ if(this.checked)
I have the following HTML: <div id=Content> <div class=MyDiv>...</div> <div class=MyDiv>...</div> </div> The MyDiv
This is my code : HTML <div class="myDiv">text under link!</div> <a class="myLinkTransparent" href="#">&nbsp;</a> <a
$('div.box').html(hello) puts the word hello inside all my div's of class 'box'. They all
Is this html <div class='title centered'>SCE</div> <div class='description'> Magna tristique pulvinar porta montes, scelerisque

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.