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 8691495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:07:56+00:00 2026-06-13T00:07:56+00:00

As noted by this question and in this fiddle, when injecting an input the

  • 0

As noted by this question and in this fiddle, when injecting an input the value attribute doesn’t seem to be added to the DOM, MooTools seems to handle it internally. Unfortunately this means that an input injected thus:

new Element("input", {type: "text", value: "injected value"}).inject(parent);

can’t be selected like so:

parent.getElements('input[value="injected value"]').length;

(this returns 0 instead of 1 as it would if the value attribute was present)

In my project I need to insert blank input boxes but only if there isn’t already a blank one;if(parent.getElements('input[value=""]').length == 0)however this is always resolving to true no matter how many blank inputs there are.

Is there a better way to achieve my goal or is there a fix for what seems like a bug?

  • 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-06-13T00:07:57+00:00Added an answer on June 13, 2026 at 12:07 am

    You could try adding:

    var x = new Element("input", {type: "text", value: "injected value"}).inject(parent);
    x.setAttribute("value",x.value);
    

    Caveat: While this fixes your issue with the element’s value attribute not being reflected, the value attribute is typically not a good way to check if a field is empty, because it is not sync’d with the input’s contents.

    It would be better to use something like this:

    $$('input[type=text]').filter(function(item){return (item.value=="");})
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

while looking at this question C# Similarities of two arrays it was noted that
As noted in this question , in a function function(e){ e.stopPropogation(); } e is
I got a CSS question related to this fiddle: http://jsfiddle.net/r584e/ Here the relevant screenshot
Having noted this question has gone unanswered after a month, I hope I can
This Question asked about listing directories (not files) in the current directory. I noted
This question has been asked a number of times, I have noted, but none
Edit: I re-asked this same question (after fixing the problems noted with this question)
UPDATED QUESTION I've updated this to be a little more succinct..: In this fiddle:
I noted what the replacements would be for purposes of this question. The sections
I'm having a hard time phrasing this question in such a way that doesn't

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.